Type removal breaking changes (#151)

* Breaking changes for type removal

Signed-off-by: Vacha Shah <[email protected]>

* Adding support to test against unreleased OpenSearch

Signed-off-by: Vacha Shah <[email protected]>

* Formatting

Signed-off-by: Vacha Shah <[email protected]>

* Addressing comments to refactor run-opensearch.sh

Signed-off-by: Vacha Shah <[email protected]>
This commit is contained in:
Vacha Shah
2022-04-13 10:47:48 -07:00
committed by GitHub
parent 092a013280
commit b1eaba0064
31 changed files with 206 additions and 624 deletions
+33 -28
View File
@@ -30,7 +30,7 @@ environment=($(cat <<-END
END END
)) ))
if [[ "$SECURE_INTEGRATION" == "false" ]] && [[ "$CLUSTER" == "opensearch" ]]; then if [[ "$SECURE_INTEGRATION" == "false" ]] && [[ "$CLUSTER" == "opensearch" ]] && [[ "$IS_UNRELEASED" == "false" ]]; then
security=($(cat <<-END security=($(cat <<-END
--env plugins.security.disabled=true --env plugins.security.disabled=true
END END
@@ -58,39 +58,44 @@ END
local_detach="true" local_detach="true"
if [[ "$i" == "$((NUMBER_OF_NODES-1))" ]]; then local_detach=$DETACH; fi if [[ "$i" == "$((NUMBER_OF_NODES-1))" ]]; then local_detach=$DETACH; fi
echo -e "\033[34;1mINFO: building $CLUSTER container\033[0m"
docker build \
--file=.ci/$CLUSTER/Dockerfile \
--build-arg SECURE_INTEGRATION=$SECURE_INTEGRATION \
--build-arg OPENSEARCH_VERSION=$OPENSEARCH_VERSION \
--tag=$CLUSTER-secure-$SECURE_INTEGRATION \
.
echo -e "\033[34;1mINFO:\033[0m Starting container $node_name \033[0m"
set -x set -x
healthcmd="curl -vvv -s --fail http://localhost:9200/_cluster/health || exit 1" healthcmd="curl -vvv -s --fail http://localhost:9200/_cluster/health || exit 1"
if [[ "$SECURE_INTEGRATION" == "true" ]]; then if [[ "$SECURE_INTEGRATION" == "true" ]]; then
healthcmd="curl -vvv -s --insecure -u admin:admin --fail https://localhost:9200/_cluster/health || exit 1" healthcmd="curl -vvv -s --insecure -u admin:admin --fail https://localhost:9200/_cluster/health || exit 1"
fi fi
docker run \ CLUSTER_TAG=$CLUSTER
--name "$node_name" \ if [[ "$IS_UNRELEASED" == "false" ]]; then
--network "$network_name" \ CLUSTER_TAG=$CLUSTER_TAG-secure-$SECURE_INTEGRATION
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \ echo -e "\033[34;1mINFO: building $CLUSTER container\033[0m"
"${environment[@]}" \ docker build \
"${volumes[@]}" \ --file=.ci/$CLUSTER/Dockerfile \
"${security[@]}" \ --build-arg SECURE_INTEGRATION=$SECURE_INTEGRATION \
--publish "$http_port":9200 \ --build-arg OPENSEARCH_VERSION=$OPENSEARCH_VERSION \
--ulimit nofile=65536:65536 \ --tag=$CLUSTER_TAG \
--ulimit memlock=-1:-1 \ .
--detach="$local_detach" \ else
--health-cmd="$(echo $healthcmd)" \ CLUSTER_TAG=$CLUSTER_TAG:test
--health-interval=2s \ fi
--health-retries=20 \ echo -e "\033[34;1mINFO:\033[0m Starting container $node_name \033[0m"
--health-timeout=2s \ docker run \
--rm \ --name "$node_name" \
-d \ --network "$network_name" \
$CLUSTER-secure-$SECURE_INTEGRATION; --env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
"${environment[@]}" \
"${volumes[@]}" \
"${security[@]}" \
--publish "$http_port":9200 \
--ulimit nofile=65536:65536 \
--ulimit memlock=-1:-1 \
--detach="$local_detach" \
--health-cmd="$(echo $healthcmd)" \
--health-interval=2s \
--health-retries=20 \
--health-timeout=2s \
--rm \
-d \
$CLUSTER_TAG;
set +x set +x
if wait_for_container "$opensearch_node_name" "$network_name"; then if wait_for_container "$opensearch_node_name" "$network_name"; then
+6
View File
@@ -15,6 +15,12 @@ else
export OPENSEARCH_URL_EXTENSION="http" export OPENSEARCH_URL_EXTENSION="http"
fi fi
export IS_UNRELEASED=false
if [[ "$OPENSEARCH_VERSION" == *"SNAPSHOT" ]]; then
IS_UNRELEASED=true
fi
echo -e "\033[1m>>>>> Unreleased is $IS_UNRELEASED >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
script_path=$(dirname $(realpath -s $0)) script_path=$(dirname $(realpath -s $0))
source $script_path/functions/imports.sh source $script_path/functions/imports.sh
set -euo pipefail set -euo pipefail
@@ -1,18 +0,0 @@
name: Integration tests with OpenDistro
on: [push, pull_request]
jobs:
integration:
name: Integ
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
secured: ["true", "false"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Integ opendistro secured=${{ matrix.secured }}
run: "./.ci/run-tests opendistro ${{ matrix.secured }}"
@@ -0,0 +1,35 @@
name: Integration with Unreleased OpenSearch
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
env:
OPENSEARCH_VERSION: '2.0'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout OpenSearch
uses: actions/checkout@v2
with:
repository: opensearch-project/opensearch
ref: ${{ env.OPENSEARCH_VERSION }}
path: opensearch
# This step builds the docker image tagged as opensearch:test. It will be further used in /ci/run-tests to test against unreleased OpenSearch.
# Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190
- name: Assemble OpenSearch
run: |
cd opensearch
./gradlew assemble
- name: Checkout Python Client
uses: actions/checkout@v2
- name: Run Integration Test
run: "./.ci/run-tests opensearch false ${{ env.OPENSEARCH_VERSION }}.0-SNAPSHOT"
+4 -1
View File
@@ -11,10 +11,13 @@ jobs:
matrix: matrix:
cluster: ["opensearch"] cluster: ["opensearch"]
secured: ["true", "false"] secured: ["true", "false"]
opensearch_version: [1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.3.0, 1.3.1] opensearch_version: []
steps: steps:
- name: Checkout - name: Checkout
if: ${{ matrix.opensearch_version != ''}}
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Integ ${{ matrix.cluster }} secured=${{ matrix.secured }} version=${{matrix.opensearch_version}} - name: Integ ${{ matrix.cluster }} secured=${{ matrix.secured }} version=${{matrix.opensearch_version}}
if: ${{ matrix.opensearch_version != ''}}
run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.opensearch_version }}" run: "./.ci/run-tests ${{ matrix.cluster }} ${{ matrix.secured }} ${{ matrix.opensearch_version }}"
+40 -117
View File
@@ -257,7 +257,7 @@ class AsyncOpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def create(self, index, id, body, doc_type=None, params=None, headers=None): async def create(self, index, id, body, params=None, headers=None):
""" """
Creates a new document in the index. Returns a 409 response when a document Creates a new document in the index. Returns a 409 response when a document
with a same ID already exists in the index. with a same ID already exists in the index.
@@ -266,7 +266,6 @@ class AsyncOpenSearch(object):
:arg index: The name of the index :arg index: The name of the index
:arg id: Document ID :arg id: Document ID
:arg body: The document :arg body: The document
:arg doc_type: The type of the document
:arg pipeline: The pipeline id to preprocess incoming documents :arg pipeline: The pipeline id to preprocess incoming documents
with with
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
@@ -288,10 +287,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_create", id)
path = _make_path(index, "_create", id)
else:
path = _make_path(index, doc_type, id, "_create")
return await self.transport.perform_request( return await self.transport.perform_request(
"PUT", path, params=params, headers=headers, body=body "PUT", path, params=params, headers=headers, body=body
@@ -310,16 +306,13 @@ class AsyncOpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def index( async def index(self, index, body, id=None, params=None, headers=None):
self, index, body, doc_type=None, id=None, params=None, headers=None
):
""" """
Creates or updates a document in an index. Creates or updates a document in an index.
:arg index: The name of the index :arg index: The name of the index
:arg body: The document :arg body: The document
:arg doc_type: The type of the document
:arg id: Document ID :arg id: Document ID
:arg if_primary_term: only perform the index operation if the :arg if_primary_term: only perform the index operation if the
last operation that has changed the document has the specified primary last operation that has changed the document has the specified primary
@@ -353,8 +346,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type is None: doc_type = "_doc"
doc_type = "_doc"
return await self.transport.perform_request( return await self.transport.perform_request(
"POST" if id in SKIP_IN_PATH else "PUT", "POST" if id in SKIP_IN_PATH else "PUT",
@@ -375,7 +367,7 @@ class AsyncOpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def bulk(self, body, index=None, doc_type=None, params=None, headers=None): async def bulk(self, body, index=None, params=None, headers=None):
""" """
Allows to perform multiple index/update/delete operations in a single request. Allows to perform multiple index/update/delete operations in a single request.
@@ -383,8 +375,6 @@ class AsyncOpenSearch(object):
:arg body: The operation definition and data (action-data :arg body: The operation definition and data (action-data
pairs), separated by newlines pairs), separated by newlines
:arg index: Default index for items which don't provide one :arg index: Default index for items which don't provide one
:arg doc_type: Default document type for items which don't
provide one
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or default list of fields to return, can be overridden on each sub- or default list of fields to return, can be overridden on each sub-
request request
@@ -414,7 +404,7 @@ class AsyncOpenSearch(object):
body = _bulk_body(self.transport.serializer, body) body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_bulk"), _make_path(index, "_bulk"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -457,9 +447,7 @@ class AsyncOpenSearch(object):
"routing", "routing",
"terminate_after", "terminate_after",
) )
async def count( async def count(self, body=None, index=None, params=None, headers=None):
self, body=None, index=None, doc_type=None, params=None, headers=None
):
""" """
Returns number of documents matching a query. Returns number of documents matching a query.
@@ -468,8 +456,6 @@ class AsyncOpenSearch(object):
Query DSL (optional) Query DSL (optional)
:arg index: A comma-separated list of indices to restrict the :arg index: A comma-separated list of indices to restrict the
results results
:arg doc_type: A comma-separated list of types to restrict the
results
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -500,7 +486,7 @@ class AsyncOpenSearch(object):
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_count"), _make_path(index, "_count"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -516,14 +502,13 @@ class AsyncOpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def delete(self, index, id, doc_type=None, params=None, headers=None): async def delete(self, index, id, params=None, headers=None):
""" """
Removes a document from the index. Removes a document from the index.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document
:arg if_primary_term: only perform the delete operation if the :arg if_primary_term: only perform the delete operation if the
last operation that has changed the document has the specified primary last operation that has changed the document has the specified primary
term term
@@ -549,8 +534,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
return await self.transport.perform_request( return await self.transport.perform_request(
"DELETE", _make_path(index, doc_type, id), params=params, headers=headers "DELETE", _make_path(index, doc_type, id), params=params, headers=headers
@@ -591,9 +575,7 @@ class AsyncOpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
async def delete_by_query( async def delete_by_query(self, index, body, params=None, headers=None):
self, index, body, doc_type=None, params=None, headers=None
):
""" """
Deletes documents matching the provided query. Deletes documents matching the provided query.
@@ -601,8 +583,6 @@ class AsyncOpenSearch(object):
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg body: The search definition using the Query DSL :arg body: The search definition using the Query DSL
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -681,7 +661,7 @@ class AsyncOpenSearch(object):
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_delete_by_query"), _make_path(index, "_delete_by_query"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -737,15 +717,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def exists(self, index, id, doc_type=None, params=None, headers=None): async def exists(self, index, id, params=None, headers=None):
""" """
Returns information about whether a document exists in an index. Returns information about whether a document exists in an index.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document (use `_all` to fetch the
first document matching the ID across all types)
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -769,8 +747,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
return await self.transport.perform_request( return await self.transport.perform_request(
"HEAD", _make_path(index, doc_type, id), params=params, headers=headers "HEAD", _make_path(index, doc_type, id), params=params, headers=headers
@@ -787,15 +764,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def exists_source(self, index, id, doc_type=None, params=None, headers=None): async def exists_source(self, index, id, params=None, headers=None):
""" """
Returns information about whether a document source exists in an index. Returns information about whether a document source exists in an index.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document; deprecated and optional
starting with 7.0
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -817,10 +792,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_source", id)
path = _make_path(index, "_source", id)
else:
path = _make_path(index, doc_type, id, "_source")
return await self.transport.perform_request( return await self.transport.perform_request(
"HEAD", path, params=params, headers=headers "HEAD", path, params=params, headers=headers
@@ -840,9 +812,7 @@ class AsyncOpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
async def explain( async def explain(self, index, id, body=None, params=None, headers=None):
self, index, id, body=None, doc_type=None, params=None, headers=None
):
""" """
Returns information about why a specific matches (or doesn't match) a query. Returns information about why a specific matches (or doesn't match) a query.
@@ -850,7 +820,6 @@ class AsyncOpenSearch(object):
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg body: The query definition using the Query DSL :arg body: The query definition using the Query DSL
:arg doc_type: The type of the document
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -877,10 +846,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_explain", id)
path = _make_path(index, "_explain", id)
else:
path = _make_path(index, doc_type, id, "_explain")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -934,15 +900,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def get(self, index, id, doc_type=None, params=None, headers=None): async def get(self, index, id, params=None, headers=None):
""" """
Returns a document. Returns a document.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document (use `_all` to fetch the
first document matching the ID across all types)
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -966,8 +930,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", _make_path(index, doc_type, id), params=params, headers=headers "GET", _make_path(index, doc_type, id), params=params, headers=headers
@@ -1000,15 +963,13 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def get_source(self, index, id, doc_type=None, params=None, headers=None): async def get_source(self, index, id, params=None, headers=None):
""" """
Returns the source of a document. Returns the source of a document.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document; deprecated and optional
starting with 7.0
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1030,10 +991,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_source", id)
path = _make_path(index, "_source", id)
else:
path = _make_path(index, doc_type, id, "_source")
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", path, params=params, headers=headers "GET", path, params=params, headers=headers
@@ -1049,7 +1007,7 @@ class AsyncOpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
async def mget(self, body, index=None, doc_type=None, params=None, headers=None): async def mget(self, body, index=None, params=None, headers=None):
""" """
Allows to get multiple documents in one request. Allows to get multiple documents in one request.
@@ -1058,7 +1016,6 @@ class AsyncOpenSearch(object):
(containing full document information) or `ids` (when index and type is (containing full document information) or `ids` (when index and type is
provided in the URL. provided in the URL.
:arg index: The name of the index :arg index: The name of the index
:arg doc_type: The type of the document
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1080,7 +1037,7 @@ class AsyncOpenSearch(object):
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_mget"), _make_path(index, "_mget"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1095,7 +1052,7 @@ class AsyncOpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
async def msearch(self, body, index=None, doc_type=None, params=None, headers=None): async def msearch(self, body, index=None, params=None, headers=None):
""" """
Allows to execute several search operations in one request. Allows to execute several search operations in one request.
@@ -1104,8 +1061,6 @@ class AsyncOpenSearch(object):
definition pairs), separated by newlines definition pairs), separated by newlines
:arg index: A comma-separated list of index names to use as :arg index: A comma-separated list of index names to use as
default default
:arg doc_type: A comma-separated list of document types to use
as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests trips should be minimized as part of cross-cluster search requests
execution Default: true execution Default: true
@@ -1135,7 +1090,7 @@ class AsyncOpenSearch(object):
body = _bulk_body(self.transport.serializer, body) body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_msearch"), _make_path(index, "_msearch"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1148,9 +1103,7 @@ class AsyncOpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
async def msearch_template( async def msearch_template(self, body, index=None, params=None, headers=None):
self, body, index=None, doc_type=None, params=None, headers=None
):
""" """
Allows to execute several search template operations in one request. Allows to execute several search template operations in one request.
@@ -1159,8 +1112,6 @@ class AsyncOpenSearch(object):
definition pairs), separated by newlines definition pairs), separated by newlines
:arg index: A comma-separated list of index names to use as :arg index: A comma-separated list of index names to use as
default default
:arg doc_type: A comma-separated list of document types to use
as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests trips should be minimized as part of cross-cluster search requests
execution Default: true execution Default: true
@@ -1179,7 +1130,7 @@ class AsyncOpenSearch(object):
body = _bulk_body(self.transport.serializer, body) body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_msearch", "template"), _make_path(index, "_msearch", "template"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1199,9 +1150,7 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def mtermvectors( async def mtermvectors(self, body=None, index=None, params=None, headers=None):
self, body=None, index=None, doc_type=None, params=None, headers=None
):
""" """
Returns multiple termvectors in one request. Returns multiple termvectors in one request.
@@ -1210,7 +1159,6 @@ class AsyncOpenSearch(object):
parameters per document here. You must at least provide a list of parameters per document here. You must at least provide a list of
document ids. See documentation. document ids. See documentation.
:arg index: The index in which the document resides. :arg index: The index in which the document resides.
:arg doc_type: The type of the document.
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be document frequencies and sum of total term frequencies should be
returned. Applies to all returned documents unless otherwise specified returned. Applies to all returned documents unless otherwise specified
@@ -1243,10 +1191,7 @@ class AsyncOpenSearch(object):
:arg version_type: Specific version type Valid choices: :arg version_type: Specific version type Valid choices:
internal, external, external_gte, force internal, external, external_gte, force
""" """
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_mtermvectors")
path = _make_path(index, "_mtermvectors")
else:
path = _make_path(index, doc_type, "_mtermvectors")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -1492,9 +1437,7 @@ class AsyncOpenSearch(object):
"typed_keys", "typed_keys",
"version", "version",
) )
async def search( async def search(self, body=None, index=None, params=None, headers=None):
self, body=None, index=None, doc_type=None, params=None, headers=None
):
""" """
Returns results matching a query. Returns results matching a query.
@@ -1502,8 +1445,6 @@ class AsyncOpenSearch(object):
:arg body: The search definition using the Query DSL :arg body: The search definition using the Query DSL
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1604,7 +1545,7 @@ class AsyncOpenSearch(object):
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_search"), _make_path(index, "_search"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1659,9 +1600,7 @@ class AsyncOpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
async def search_template( async def search_template(self, body, index=None, params=None, headers=None):
self, body, index=None, doc_type=None, params=None, headers=None
):
""" """
Allows to use the Mustache language to pre-render a search definition. Allows to use the Mustache language to pre-render a search definition.
@@ -1669,8 +1608,6 @@ class AsyncOpenSearch(object):
:arg body: The search definition template and its params :arg body: The search definition template and its params
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -1704,7 +1641,7 @@ class AsyncOpenSearch(object):
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_search", "template"), _make_path(index, "_search", "template"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1723,9 +1660,7 @@ class AsyncOpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
async def termvectors( async def termvectors(self, index, body=None, id=None, params=None, headers=None):
self, index, body=None, doc_type=None, id=None, params=None, headers=None
):
""" """
Returns information and statistics about terms in the fields of a particular Returns information and statistics about terms in the fields of a particular
document. document.
@@ -1734,7 +1669,6 @@ class AsyncOpenSearch(object):
:arg index: The index in which the document resides. :arg index: The index in which the document resides.
:arg body: Define parameters and or supply a document to get :arg body: Define parameters and or supply a document to get
termvectors for. See documentation. termvectors for. See documentation.
:arg doc_type: The type of the document.
:arg id: The id of the document, when not specified a doc param :arg id: The id of the document, when not specified a doc param
should be supplied. should be supplied.
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
@@ -1761,10 +1695,7 @@ class AsyncOpenSearch(object):
if index in SKIP_IN_PATH: if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.") raise ValueError("Empty value passed for a required argument 'index'.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_termvectors", id)
path = _make_path(index, "_termvectors", id)
else:
path = _make_path(index, doc_type, id, "_termvectors")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -1784,7 +1715,7 @@ class AsyncOpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
async def update(self, index, id, body, doc_type=None, params=None, headers=None): async def update(self, index, id, body, params=None, headers=None):
""" """
Updates a document with a script or partial document. Updates a document with a script or partial document.
@@ -1793,7 +1724,6 @@ class AsyncOpenSearch(object):
:arg id: Document ID :arg id: Document ID
:arg body: The request definition requires either `script` or :arg body: The request definition requires either `script` or
partial `doc` partial `doc`
:arg doc_type: The type of the document
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1827,10 +1757,7 @@ class AsyncOpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_update", id)
path = _make_path(index, "_update", id)
else:
path = _make_path(index, doc_type, id, "_update")
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -1873,9 +1800,7 @@ class AsyncOpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
async def update_by_query( async def update_by_query(self, index, body=None, params=None, headers=None):
self, index, body=None, doc_type=None, params=None, headers=None
):
""" """
Performs an update on every document in the index without changing the source, Performs an update on every document in the index without changing the source,
for example to pick up a mapping change. for example to pick up a mapping change.
@@ -1884,8 +1809,6 @@ class AsyncOpenSearch(object):
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg body: The search definition using the Query DSL :arg body: The search definition using the Query DSL
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1967,7 +1890,7 @@ class AsyncOpenSearch(object):
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_update_by_query"), _make_path(index, "_update_by_query"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
-20
View File
@@ -105,7 +105,6 @@ class AsyncOpenSearch(object):
id: Any, id: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
pipeline: Optional[Any] = ..., pipeline: Optional[Any] = ...,
refresh: Optional[Any] = ..., refresh: Optional[Any] = ...,
routing: Optional[Any] = ..., routing: Optional[Any] = ...,
@@ -131,7 +130,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
id: Optional[Any] = ..., id: Optional[Any] = ...,
if_primary_term: Optional[Any] = ..., if_primary_term: Optional[Any] = ...,
if_seq_no: Optional[Any] = ..., if_seq_no: Optional[Any] = ...,
@@ -162,7 +160,6 @@ class AsyncOpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -208,7 +205,6 @@ class AsyncOpenSearch(object):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
analyze_wildcard: Optional[Any] = ..., analyze_wildcard: Optional[Any] = ...,
analyzer: Optional[Any] = ..., analyzer: Optional[Any] = ...,
@@ -241,7 +237,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
if_primary_term: Optional[Any] = ..., if_primary_term: Optional[Any] = ...,
if_seq_no: Optional[Any] = ..., if_seq_no: Optional[Any] = ...,
refresh: Optional[Any] = ..., refresh: Optional[Any] = ...,
@@ -268,7 +263,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -357,7 +351,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -386,7 +379,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -415,7 +407,6 @@ class AsyncOpenSearch(object):
id: Any, id: Any,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -469,7 +460,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -516,7 +506,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -544,7 +533,6 @@ class AsyncOpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -571,7 +559,6 @@ class AsyncOpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
ccs_minimize_roundtrips: Optional[Any] = ..., ccs_minimize_roundtrips: Optional[Any] = ...,
max_concurrent_searches: Optional[Any] = ..., max_concurrent_searches: Optional[Any] = ...,
max_concurrent_shard_requests: Optional[Any] = ..., max_concurrent_shard_requests: Optional[Any] = ...,
@@ -597,7 +584,6 @@ class AsyncOpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
ccs_minimize_roundtrips: Optional[Any] = ..., ccs_minimize_roundtrips: Optional[Any] = ...,
max_concurrent_searches: Optional[Any] = ..., max_concurrent_searches: Optional[Any] = ...,
rest_total_hits_as_int: Optional[Any] = ..., rest_total_hits_as_int: Optional[Any] = ...,
@@ -621,7 +607,6 @@ class AsyncOpenSearch(object):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
field_statistics: Optional[Any] = ..., field_statistics: Optional[Any] = ...,
fields: Optional[Any] = ..., fields: Optional[Any] = ...,
ids: Optional[Any] = ..., ids: Optional[Any] = ...,
@@ -793,7 +778,6 @@ class AsyncOpenSearch(object):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -878,7 +862,6 @@ class AsyncOpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
ccs_minimize_roundtrips: Optional[Any] = ..., ccs_minimize_roundtrips: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
@@ -910,7 +893,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
id: Optional[Any] = ..., id: Optional[Any] = ...,
field_statistics: Optional[Any] = ..., field_statistics: Optional[Any] = ...,
fields: Optional[Any] = ..., fields: Optional[Any] = ...,
@@ -942,7 +924,6 @@ class AsyncOpenSearch(object):
id: Any, id: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -973,7 +954,6 @@ class AsyncOpenSearch(object):
index: Any, index: Any,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
+8 -80
View File
@@ -332,38 +332,6 @@ class IndicesClient(NamespacedClient):
"HEAD", _make_path(index), params=params, headers=headers "HEAD", _make_path(index), params=params, headers=headers
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local")
async def exists_type(self, index, doc_type, params=None, headers=None):
"""
Returns information about whether a particular document type exists.
(DEPRECATED)
:arg index: A comma-separated list of index names; use `_all` to
check the types across all indices
:arg doc_type: A comma-separated list of document types to check
:arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg local: Return local information, do not retrieve the state
from master node (default: false)
"""
for param in (index, doc_type):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"HEAD",
_make_path(index, "_mapping", doc_type),
params=params,
headers=headers,
)
@query_params( @query_params(
"allow_no_indices", "allow_no_indices",
"expand_wildcards", "expand_wildcards",
@@ -373,9 +341,7 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"write_index_only", "write_index_only",
) )
async def put_mapping( async def put_mapping(self, body, index=None, params=None, headers=None):
self, body, index=None, doc_type=None, params=None, headers=None
):
""" """
Updates the index mappings. Updates the index mappings.
@@ -384,7 +350,6 @@ class IndicesClient(NamespacedClient):
:arg index: A comma-separated list of index names the mapping :arg index: A comma-separated list of index names the mapping
should be added to (supports wildcards); use `_all` or omit to add the should be added to (supports wildcards); use `_all` or omit to add the
mapping on all indices. mapping on all indices.
:arg doc_type: The name of the document type
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -403,12 +368,9 @@ class IndicesClient(NamespacedClient):
if body in SKIP_IN_PATH: if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.") raise ValueError("Empty value passed for a required argument 'body'.")
if doc_type not in SKIP_IN_PATH and index in SKIP_IN_PATH:
index = "_all"
return await self.transport.perform_request( return await self.transport.perform_request(
"PUT", "PUT",
_make_path(index, doc_type, "_mapping"), _make_path(index, "_mapping"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -422,13 +384,12 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
async def get_mapping(self, index=None, doc_type=None, params=None, headers=None): async def get_mapping(self, index=None, params=None, headers=None):
""" """
Returns mappings for one or more indices. Returns mappings for one or more indices.
:arg index: A comma-separated list of index names :arg index: A comma-separated list of index names
:arg doc_type: A comma-separated list of document types
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -445,7 +406,7 @@ class IndicesClient(NamespacedClient):
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "GET",
_make_path(index, "_mapping", doc_type), _make_path(index, "_mapping"),
params=params, params=params,
headers=headers, headers=headers,
) )
@@ -458,16 +419,13 @@ class IndicesClient(NamespacedClient):
"include_type_name", "include_type_name",
"local", "local",
) )
async def get_field_mapping( async def get_field_mapping(self, fields, index=None, params=None, headers=None):
self, fields, index=None, doc_type=None, params=None, headers=None
):
""" """
Returns mapping for one or more fields. Returns mapping for one or more fields.
:arg fields: A comma-separated list of fields :arg fields: A comma-separated list of fields
:arg index: A comma-separated list of index names :arg index: A comma-separated list of index names
:arg doc_type: A comma-separated list of document types
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -488,7 +446,7 @@ class IndicesClient(NamespacedClient):
return await self.transport.perform_request( return await self.transport.perform_request(
"GET", "GET",
_make_path(index, "_mapping", doc_type, "field", fields), _make_path(index, "_mapping", "field", fields),
params=params, params=params,
headers=headers, headers=headers,
) )
@@ -867,9 +825,7 @@ class IndicesClient(NamespacedClient):
"q", "q",
"rewrite", "rewrite",
) )
async def validate_query( async def validate_query(self, body=None, index=None, params=None, headers=None):
self, body=None, index=None, doc_type=None, params=None, headers=None
):
""" """
Allows a user to validate a potentially expensive query without executing it. Allows a user to validate a potentially expensive query without executing it.
@@ -878,9 +834,6 @@ class IndicesClient(NamespacedClient):
:arg index: A comma-separated list of index names to restrict :arg index: A comma-separated list of index names to restrict
the operation; use `_all` or empty string to perform the operation on the operation; use `_all` or empty string to perform the operation on
all indices all indices
:arg doc_type: A comma-separated list of document types to
restrict the operation; leave empty to perform the operation on all
types
:arg all_shards: Execute validation on all shards instead of one :arg all_shards: Execute validation on all shards instead of one
random shard per index random shard per index
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
@@ -907,7 +860,7 @@ class IndicesClient(NamespacedClient):
""" """
return await self.transport.perform_request( return await self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_validate", "query"), _make_path(index, "_validate", "query"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1016,31 +969,6 @@ class IndicesClient(NamespacedClient):
"GET", _make_path(index, "_upgrade"), params=params, headers=headers "GET", _make_path(index, "_upgrade"), params=params, headers=headers
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
async def flush_synced(self, index=None, params=None, headers=None):
"""
Performs a synced flush operation on one or more indices. Synced flush is
deprecated. Use flush instead
:arg index: A comma-separated list of index names; use `_all` or
empty string for all indices
:arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
"""
return await self.transport.perform_request(
"POST",
_make_path(index, "_flush", "synced"),
params=params,
headers=headers,
)
@query_params( @query_params(
"allow_no_indices", "expand_wildcards", "ignore_unavailable", "status" "allow_no_indices", "expand_wildcards", "ignore_unavailable", "status"
) )
-26
View File
@@ -249,34 +249,11 @@ class IndicesClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ..., params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ..., headers: Optional[MutableMapping[str, str]] = ...,
) -> bool: ... ) -> bool: ...
async def exists_type(
self,
index: Any,
doc_type: Any,
*,
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
local: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> bool: ...
async def put_mapping( async def put_mapping(
self, self,
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
@@ -301,7 +278,6 @@ class IndicesClient(NamespacedClient):
self, self,
*, *,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
@@ -326,7 +302,6 @@ class IndicesClient(NamespacedClient):
fields: Any, fields: Any,
*, *,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
@@ -636,7 +611,6 @@ class IndicesClient(NamespacedClient):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
all_shards: Optional[Any] = ..., all_shards: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
analyze_wildcard: Optional[Any] = ..., analyze_wildcard: Optional[Any] = ...,
+40 -106
View File
@@ -257,7 +257,7 @@ class OpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
def create(self, index, id, body, doc_type=None, params=None, headers=None): def create(self, index, id, body, params=None, headers=None):
""" """
Creates a new document in the index. Returns a 409 response when a document Creates a new document in the index. Returns a 409 response when a document
with a same ID already exists in the index. with a same ID already exists in the index.
@@ -266,7 +266,6 @@ class OpenSearch(object):
:arg index: The name of the index :arg index: The name of the index
:arg id: Document ID :arg id: Document ID
:arg body: The document :arg body: The document
:arg doc_type: The type of the document
:arg pipeline: The pipeline id to preprocess incoming documents :arg pipeline: The pipeline id to preprocess incoming documents
with with
:arg refresh: If `true` then refresh the affected shards to make :arg refresh: If `true` then refresh the affected shards to make
@@ -288,10 +287,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_create", id)
path = _make_path(index, "_create", id)
else:
path = _make_path(index, doc_type, id, "_create")
return self.transport.perform_request( return self.transport.perform_request(
"PUT", path, params=params, headers=headers, body=body "PUT", path, params=params, headers=headers, body=body
@@ -310,14 +306,13 @@ class OpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
def index(self, index, body, doc_type=None, id=None, params=None, headers=None): def index(self, index, body, id=None, params=None, headers=None):
""" """
Creates or updates a document in an index. Creates or updates a document in an index.
:arg index: The name of the index :arg index: The name of the index
:arg body: The document :arg body: The document
:arg doc_type: The type of the document
:arg id: Document ID :arg id: Document ID
:arg if_primary_term: only perform the index operation if the :arg if_primary_term: only perform the index operation if the
last operation that has changed the document has the specified primary last operation that has changed the document has the specified primary
@@ -351,8 +346,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type is None: doc_type = "_doc"
doc_type = "_doc"
return self.transport.perform_request( return self.transport.perform_request(
"POST" if id in SKIP_IN_PATH else "PUT", "POST" if id in SKIP_IN_PATH else "PUT",
@@ -373,7 +367,7 @@ class OpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def bulk(self, body, index=None, doc_type=None, params=None, headers=None): def bulk(self, body, index=None, params=None, headers=None):
""" """
Allows to perform multiple index/update/delete operations in a single request. Allows to perform multiple index/update/delete operations in a single request.
@@ -381,8 +375,6 @@ class OpenSearch(object):
:arg body: The operation definition and data (action-data :arg body: The operation definition and data (action-data
pairs), separated by newlines pairs), separated by newlines
:arg index: Default index for items which don't provide one :arg index: Default index for items which don't provide one
:arg doc_type: Default document type for items which don't
provide one
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or default list of fields to return, can be overridden on each sub- or default list of fields to return, can be overridden on each sub-
request request
@@ -412,7 +404,7 @@ class OpenSearch(object):
body = _bulk_body(self.transport.serializer, body) body = _bulk_body(self.transport.serializer, body)
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_bulk"), _make_path(index, "_bulk"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -455,7 +447,7 @@ class OpenSearch(object):
"routing", "routing",
"terminate_after", "terminate_after",
) )
def count(self, body=None, index=None, doc_type=None, params=None, headers=None): def count(self, body=None, index=None, params=None, headers=None):
""" """
Returns number of documents matching a query. Returns number of documents matching a query.
@@ -464,8 +456,6 @@ class OpenSearch(object):
Query DSL (optional) Query DSL (optional)
:arg index: A comma-separated list of indices to restrict the :arg index: A comma-separated list of indices to restrict the
results results
:arg doc_type: A comma-separated list of types to restrict the
results
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -496,7 +486,7 @@ class OpenSearch(object):
""" """
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_count"), _make_path(index, "_count"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -512,14 +502,13 @@ class OpenSearch(object):
"version_type", "version_type",
"wait_for_active_shards", "wait_for_active_shards",
) )
def delete(self, index, id, doc_type=None, params=None, headers=None): def delete(self, index, id, params=None, headers=None):
""" """
Removes a document from the index. Removes a document from the index.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document
:arg if_primary_term: only perform the delete operation if the :arg if_primary_term: only perform the delete operation if the
last operation that has changed the document has the specified primary last operation that has changed the document has the specified primary
term term
@@ -545,8 +534,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
return self.transport.perform_request( return self.transport.perform_request(
"DELETE", _make_path(index, doc_type, id), params=params, headers=headers "DELETE", _make_path(index, doc_type, id), params=params, headers=headers
@@ -587,7 +575,7 @@ class OpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
def delete_by_query(self, index, body, doc_type=None, params=None, headers=None): def delete_by_query(self, index, body, params=None, headers=None):
""" """
Deletes documents matching the provided query. Deletes documents matching the provided query.
@@ -595,8 +583,6 @@ class OpenSearch(object):
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg body: The search definition using the Query DSL :arg body: The search definition using the Query DSL
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -675,7 +661,7 @@ class OpenSearch(object):
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_delete_by_query"), _make_path(index, "_delete_by_query"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -731,15 +717,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def exists(self, index, id, doc_type=None, params=None, headers=None): def exists(self, index, id, params=None, headers=None):
""" """
Returns information about whether a document exists in an index. Returns information about whether a document exists in an index.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document (use `_all` to fetch the
first document matching the ID across all types)
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -763,8 +747,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
return self.transport.perform_request( return self.transport.perform_request(
"HEAD", _make_path(index, doc_type, id), params=params, headers=headers "HEAD", _make_path(index, doc_type, id), params=params, headers=headers
@@ -781,15 +764,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def exists_source(self, index, id, doc_type=None, params=None, headers=None): def exists_source(self, index, id, params=None, headers=None):
""" """
Returns information about whether a document source exists in an index. Returns information about whether a document source exists in an index.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document; deprecated and optional
starting with 7.0
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -811,10 +792,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_source", id)
path = _make_path(index, "_source", id)
else:
path = _make_path(index, doc_type, id, "_source")
return self.transport.perform_request( return self.transport.perform_request(
"HEAD", path, params=params, headers=headers "HEAD", path, params=params, headers=headers
@@ -834,7 +812,7 @@ class OpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
def explain(self, index, id, body=None, doc_type=None, params=None, headers=None): def explain(self, index, id, body=None, params=None, headers=None):
""" """
Returns information about why a specific matches (or doesn't match) a query. Returns information about why a specific matches (or doesn't match) a query.
@@ -842,7 +820,6 @@ class OpenSearch(object):
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg body: The query definition using the Query DSL :arg body: The query definition using the Query DSL
:arg doc_type: The type of the document
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -869,10 +846,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_explain", id)
path = _make_path(index, "_explain", id)
else:
path = _make_path(index, doc_type, id, "_explain")
return self.transport.perform_request( return self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -926,15 +900,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def get(self, index, id, doc_type=None, params=None, headers=None): def get(self, index, id, params=None, headers=None):
""" """
Returns a document. Returns a document.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document (use `_all` to fetch the
first document matching the ID across all types)
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -958,8 +930,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
return self.transport.perform_request( return self.transport.perform_request(
"GET", _make_path(index, doc_type, id), params=params, headers=headers "GET", _make_path(index, doc_type, id), params=params, headers=headers
@@ -992,15 +963,13 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def get_source(self, index, id, doc_type=None, params=None, headers=None): def get_source(self, index, id, params=None, headers=None):
""" """
Returns the source of a document. Returns the source of a document.
:arg index: The name of the index :arg index: The name of the index
:arg id: The document ID :arg id: The document ID
:arg doc_type: The type of the document; deprecated and optional
starting with 7.0
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1022,10 +991,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_source", id)
path = _make_path(index, "_source", id)
else:
path = _make_path(index, doc_type, id, "_source")
return self.transport.perform_request( return self.transport.perform_request(
"GET", path, params=params, headers=headers "GET", path, params=params, headers=headers
@@ -1041,7 +1007,7 @@ class OpenSearch(object):
"routing", "routing",
"stored_fields", "stored_fields",
) )
def mget(self, body, index=None, doc_type=None, params=None, headers=None): def mget(self, body, index=None, params=None, headers=None):
""" """
Allows to get multiple documents in one request. Allows to get multiple documents in one request.
@@ -1050,7 +1016,6 @@ class OpenSearch(object):
(containing full document information) or `ids` (when index and type is (containing full document information) or `ids` (when index and type is
provided in the URL. provided in the URL.
:arg index: The name of the index :arg index: The name of the index
:arg doc_type: The type of the document
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1072,7 +1037,7 @@ class OpenSearch(object):
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_mget"), _make_path(index, "_mget"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1087,7 +1052,7 @@ class OpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
def msearch(self, body, index=None, doc_type=None, params=None, headers=None): def msearch(self, body, index=None, params=None, headers=None):
""" """
Allows to execute several search operations in one request. Allows to execute several search operations in one request.
@@ -1096,8 +1061,6 @@ class OpenSearch(object):
definition pairs), separated by newlines definition pairs), separated by newlines
:arg index: A comma-separated list of index names to use as :arg index: A comma-separated list of index names to use as
default default
:arg doc_type: A comma-separated list of document types to use
as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests trips should be minimized as part of cross-cluster search requests
execution Default: true execution Default: true
@@ -1127,7 +1090,7 @@ class OpenSearch(object):
body = _bulk_body(self.transport.serializer, body) body = _bulk_body(self.transport.serializer, body)
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_msearch"), _make_path(index, "_msearch"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1140,9 +1103,7 @@ class OpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
def msearch_template( def msearch_template(self, body, index=None, params=None, headers=None):
self, body, index=None, doc_type=None, params=None, headers=None
):
""" """
Allows to execute several search template operations in one request. Allows to execute several search template operations in one request.
@@ -1151,8 +1112,6 @@ class OpenSearch(object):
definition pairs), separated by newlines definition pairs), separated by newlines
:arg index: A comma-separated list of index names to use as :arg index: A comma-separated list of index names to use as
default default
:arg doc_type: A comma-separated list of document types to use
as default
:arg ccs_minimize_roundtrips: Indicates whether network round- :arg ccs_minimize_roundtrips: Indicates whether network round-
trips should be minimized as part of cross-cluster search requests trips should be minimized as part of cross-cluster search requests
execution Default: true execution Default: true
@@ -1171,7 +1130,7 @@ class OpenSearch(object):
body = _bulk_body(self.transport.serializer, body) body = _bulk_body(self.transport.serializer, body)
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_msearch", "template"), _make_path(index, "_msearch", "template"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1191,9 +1150,7 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def mtermvectors( def mtermvectors(self, body=None, index=None, params=None, headers=None):
self, body=None, index=None, doc_type=None, params=None, headers=None
):
""" """
Returns multiple termvectors in one request. Returns multiple termvectors in one request.
@@ -1202,7 +1159,6 @@ class OpenSearch(object):
parameters per document here. You must at least provide a list of parameters per document here. You must at least provide a list of
document ids. See documentation. document ids. See documentation.
:arg index: The index in which the document resides. :arg index: The index in which the document resides.
:arg doc_type: The type of the document.
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
document frequencies and sum of total term frequencies should be document frequencies and sum of total term frequencies should be
returned. Applies to all returned documents unless otherwise specified returned. Applies to all returned documents unless otherwise specified
@@ -1235,10 +1191,7 @@ class OpenSearch(object):
:arg version_type: Specific version type Valid choices: :arg version_type: Specific version type Valid choices:
internal, external, external_gte, force internal, external, external_gte, force
""" """
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_mtermvectors")
path = _make_path(index, "_mtermvectors")
else:
path = _make_path(index, doc_type, "_mtermvectors")
return self.transport.perform_request( return self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -1482,7 +1435,7 @@ class OpenSearch(object):
"typed_keys", "typed_keys",
"version", "version",
) )
def search(self, body=None, index=None, doc_type=None, params=None, headers=None): def search(self, body=None, index=None, params=None, headers=None):
""" """
Returns results matching a query. Returns results matching a query.
@@ -1490,8 +1443,6 @@ class OpenSearch(object):
:arg body: The search definition using the Query DSL :arg body: The search definition using the Query DSL
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1592,7 +1543,7 @@ class OpenSearch(object):
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_search"), _make_path(index, "_search"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1647,9 +1598,7 @@ class OpenSearch(object):
"search_type", "search_type",
"typed_keys", "typed_keys",
) )
def search_template( def search_template(self, body, index=None, params=None, headers=None):
self, body, index=None, doc_type=None, params=None, headers=None
):
""" """
Allows to use the Mustache language to pre-render a search definition. Allows to use the Mustache language to pre-render a search definition.
@@ -1657,8 +1606,6 @@ class OpenSearch(object):
:arg body: The search definition template and its params :arg body: The search definition template and its params
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -1692,7 +1639,7 @@ class OpenSearch(object):
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_search", "template"), _make_path(index, "_search", "template"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -1711,9 +1658,7 @@ class OpenSearch(object):
"version", "version",
"version_type", "version_type",
) )
def termvectors( def termvectors(self, index, body=None, id=None, params=None, headers=None):
self, index, body=None, doc_type=None, id=None, params=None, headers=None
):
""" """
Returns information and statistics about terms in the fields of a particular Returns information and statistics about terms in the fields of a particular
document. document.
@@ -1722,7 +1667,6 @@ class OpenSearch(object):
:arg index: The index in which the document resides. :arg index: The index in which the document resides.
:arg body: Define parameters and or supply a document to get :arg body: Define parameters and or supply a document to get
termvectors for. See documentation. termvectors for. See documentation.
:arg doc_type: The type of the document.
:arg id: The id of the document, when not specified a doc param :arg id: The id of the document, when not specified a doc param
should be supplied. should be supplied.
:arg field_statistics: Specifies if document count, sum of :arg field_statistics: Specifies if document count, sum of
@@ -1749,10 +1693,7 @@ class OpenSearch(object):
if index in SKIP_IN_PATH: if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.") raise ValueError("Empty value passed for a required argument 'index'.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_termvectors", id)
path = _make_path(index, "_termvectors", id)
else:
path = _make_path(index, doc_type, id, "_termvectors")
return self.transport.perform_request( return self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -1772,7 +1713,7 @@ class OpenSearch(object):
"timeout", "timeout",
"wait_for_active_shards", "wait_for_active_shards",
) )
def update(self, index, id, body, doc_type=None, params=None, headers=None): def update(self, index, id, body, params=None, headers=None):
""" """
Updates a document with a script or partial document. Updates a document with a script or partial document.
@@ -1781,7 +1722,6 @@ class OpenSearch(object):
:arg id: Document ID :arg id: Document ID
:arg body: The request definition requires either `script` or :arg body: The request definition requires either `script` or
partial `doc` partial `doc`
:arg doc_type: The type of the document
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the :arg _source_excludes: A list of fields to exclude from the
@@ -1815,10 +1755,7 @@ class OpenSearch(object):
if param in SKIP_IN_PATH: if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.") raise ValueError("Empty value passed for a required argument.")
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_update", id)
path = _make_path(index, "_update", id)
else:
path = _make_path(index, doc_type, id, "_update")
return self.transport.perform_request( return self.transport.perform_request(
"POST", path, params=params, headers=headers, body=body "POST", path, params=params, headers=headers, body=body
@@ -1861,9 +1798,7 @@ class OpenSearch(object):
"wait_for_active_shards", "wait_for_active_shards",
"wait_for_completion", "wait_for_completion",
) )
def update_by_query( def update_by_query(self, index, body=None, params=None, headers=None):
self, index, body=None, doc_type=None, params=None, headers=None
):
""" """
Performs an update on every document in the index without changing the source, Performs an update on every document in the index without changing the source,
for example to pick up a mapping change. for example to pick up a mapping change.
@@ -1872,7 +1807,6 @@ class OpenSearch(object):
:arg index: A comma-separated list of index names to search; use :arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices `_all` or empty string to perform the operation on all indices
:arg body: The search definition using the Query DSL :arg body: The search definition using the Query DSL
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types search; leave empty to perform the operation on all types
:arg _source: True or false to return the _source field or not, :arg _source: True or false to return the _source field or not,
or a list of fields to return or a list of fields to return
@@ -1955,7 +1889,7 @@ class OpenSearch(object):
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_update_by_query"), _make_path(index, "_update_by_query"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
-20
View File
@@ -105,7 +105,6 @@ class OpenSearch(object):
id: Any, id: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
pipeline: Optional[Any] = ..., pipeline: Optional[Any] = ...,
refresh: Optional[Any] = ..., refresh: Optional[Any] = ...,
routing: Optional[Any] = ..., routing: Optional[Any] = ...,
@@ -131,7 +130,6 @@ class OpenSearch(object):
index: Any, index: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
id: Optional[Any] = ..., id: Optional[Any] = ...,
if_primary_term: Optional[Any] = ..., if_primary_term: Optional[Any] = ...,
if_seq_no: Optional[Any] = ..., if_seq_no: Optional[Any] = ...,
@@ -162,7 +160,6 @@ class OpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -208,7 +205,6 @@ class OpenSearch(object):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
analyze_wildcard: Optional[Any] = ..., analyze_wildcard: Optional[Any] = ...,
analyzer: Optional[Any] = ..., analyzer: Optional[Any] = ...,
@@ -241,7 +237,6 @@ class OpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
if_primary_term: Optional[Any] = ..., if_primary_term: Optional[Any] = ...,
if_seq_no: Optional[Any] = ..., if_seq_no: Optional[Any] = ...,
refresh: Optional[Any] = ..., refresh: Optional[Any] = ...,
@@ -268,7 +263,6 @@ class OpenSearch(object):
index: Any, index: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -357,7 +351,6 @@ class OpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -386,7 +379,6 @@ class OpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -415,7 +407,6 @@ class OpenSearch(object):
id: Any, id: Any,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -469,7 +460,6 @@ class OpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -516,7 +506,6 @@ class OpenSearch(object):
index: Any, index: Any,
id: Any, id: Any,
*, *,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -544,7 +533,6 @@ class OpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -571,7 +559,6 @@ class OpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
ccs_minimize_roundtrips: Optional[Any] = ..., ccs_minimize_roundtrips: Optional[Any] = ...,
max_concurrent_searches: Optional[Any] = ..., max_concurrent_searches: Optional[Any] = ...,
max_concurrent_shard_requests: Optional[Any] = ..., max_concurrent_shard_requests: Optional[Any] = ...,
@@ -597,7 +584,6 @@ class OpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
ccs_minimize_roundtrips: Optional[Any] = ..., ccs_minimize_roundtrips: Optional[Any] = ...,
max_concurrent_searches: Optional[Any] = ..., max_concurrent_searches: Optional[Any] = ...,
rest_total_hits_as_int: Optional[Any] = ..., rest_total_hits_as_int: Optional[Any] = ...,
@@ -621,7 +607,6 @@ class OpenSearch(object):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
field_statistics: Optional[Any] = ..., field_statistics: Optional[Any] = ...,
fields: Optional[Any] = ..., fields: Optional[Any] = ...,
ids: Optional[Any] = ..., ids: Optional[Any] = ...,
@@ -793,7 +778,6 @@ class OpenSearch(object):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -878,7 +862,6 @@ class OpenSearch(object):
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
ccs_minimize_roundtrips: Optional[Any] = ..., ccs_minimize_roundtrips: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
@@ -910,7 +893,6 @@ class OpenSearch(object):
index: Any, index: Any,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
id: Optional[Any] = ..., id: Optional[Any] = ...,
field_statistics: Optional[Any] = ..., field_statistics: Optional[Any] = ...,
fields: Optional[Any] = ..., fields: Optional[Any] = ...,
@@ -942,7 +924,6 @@ class OpenSearch(object):
id: Any, id: Any,
*, *,
body: Any, body: Any,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
@@ -973,7 +954,6 @@ class OpenSearch(object):
index: Any, index: Any,
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
_source: Optional[Any] = ..., _source: Optional[Any] = ...,
_source_excludes: Optional[Any] = ..., _source_excludes: Optional[Any] = ...,
_source_includes: Optional[Any] = ..., _source_includes: Optional[Any] = ...,
+9 -49
View File
@@ -332,38 +332,6 @@ class IndicesClient(NamespacedClient):
"HEAD", _make_path(index), params=params, headers=headers "HEAD", _make_path(index), params=params, headers=headers
) )
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable", "local")
def exists_type(self, index, doc_type, params=None, headers=None):
"""
Returns information about whether a particular document type exists.
(DEPRECATED)
:arg index: A comma-separated list of index names; use `_all` to
check the types across all indices
:arg doc_type: A comma-separated list of document types to check
:arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified)
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: open
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg local: Return local information, do not retrieve the state
from master node (default: false)
"""
for param in (index, doc_type):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"HEAD",
_make_path(index, "_mapping", doc_type),
params=params,
headers=headers,
)
@query_params( @query_params(
"allow_no_indices", "allow_no_indices",
"expand_wildcards", "expand_wildcards",
@@ -373,7 +341,7 @@ class IndicesClient(NamespacedClient):
"timeout", "timeout",
"write_index_only", "write_index_only",
) )
def put_mapping(self, body, index=None, doc_type=None, params=None, headers=None): def put_mapping(self, body, index=None, params=None, headers=None):
""" """
Updates the index mappings. Updates the index mappings.
@@ -382,7 +350,6 @@ class IndicesClient(NamespacedClient):
:arg index: A comma-separated list of index names the mapping :arg index: A comma-separated list of index names the mapping
should be added to (supports wildcards); use `_all` or omit to add the should be added to (supports wildcards); use `_all` or omit to add the
mapping on all indices. mapping on all indices.
:arg doc_type: The name of the document type
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -401,12 +368,12 @@ class IndicesClient(NamespacedClient):
if body in SKIP_IN_PATH: if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.") raise ValueError("Empty value passed for a required argument 'body'.")
if doc_type not in SKIP_IN_PATH and index in SKIP_IN_PATH: if index in SKIP_IN_PATH:
index = "_all" index = "_all"
return self.transport.perform_request( return self.transport.perform_request(
"PUT", "PUT",
_make_path(index, doc_type, "_mapping"), _make_path(index, "_mapping"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
@@ -420,13 +387,12 @@ class IndicesClient(NamespacedClient):
"local", "local",
"master_timeout", "master_timeout",
) )
def get_mapping(self, index=None, doc_type=None, params=None, headers=None): def get_mapping(self, index=None, params=None, headers=None):
""" """
Returns mappings for one or more indices. Returns mappings for one or more indices.
:arg index: A comma-separated list of index names :arg index: A comma-separated list of index names
:arg doc_type: A comma-separated list of document types
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -443,7 +409,7 @@ class IndicesClient(NamespacedClient):
""" """
return self.transport.perform_request( return self.transport.perform_request(
"GET", "GET",
_make_path(index, "_mapping", doc_type), _make_path(index, "_mapping"),
params=params, params=params,
headers=headers, headers=headers,
) )
@@ -456,16 +422,13 @@ class IndicesClient(NamespacedClient):
"include_type_name", "include_type_name",
"local", "local",
) )
def get_field_mapping( def get_field_mapping(self, fields, index=None, params=None, headers=None):
self, fields, index=None, doc_type=None, params=None, headers=None
):
""" """
Returns mapping for one or more fields. Returns mapping for one or more fields.
:arg fields: A comma-separated list of fields :arg fields: A comma-separated list of fields
:arg index: A comma-separated list of index names :arg index: A comma-separated list of index names
:arg doc_type: A comma-separated list of document types
:arg allow_no_indices: Whether to ignore if a wildcard indices :arg allow_no_indices: Whether to ignore if a wildcard indices
expression resolves into no concrete indices. (This includes `_all` expression resolves into no concrete indices. (This includes `_all`
string or when no indices have been specified) string or when no indices have been specified)
@@ -486,7 +449,7 @@ class IndicesClient(NamespacedClient):
return self.transport.perform_request( return self.transport.perform_request(
"GET", "GET",
_make_path(index, "_mapping", doc_type, "field", fields), _make_path(index, "_mapping", "field", fields),
params=params, params=params,
headers=headers, headers=headers,
) )
@@ -865,9 +828,7 @@ class IndicesClient(NamespacedClient):
"q", "q",
"rewrite", "rewrite",
) )
def validate_query( def validate_query(self, body=None, index=None, params=None, headers=None):
self, body=None, index=None, doc_type=None, params=None, headers=None
):
""" """
Allows a user to validate a potentially expensive query without executing it. Allows a user to validate a potentially expensive query without executing it.
@@ -876,7 +837,6 @@ class IndicesClient(NamespacedClient):
:arg index: A comma-separated list of index names to restrict :arg index: A comma-separated list of index names to restrict
the operation; use `_all` or empty string to perform the operation on the operation; use `_all` or empty string to perform the operation on
all indices all indices
:arg doc_type: A comma-separated list of document types to
restrict the operation; leave empty to perform the operation on all restrict the operation; leave empty to perform the operation on all
types types
:arg all_shards: Execute validation on all shards instead of one :arg all_shards: Execute validation on all shards instead of one
@@ -905,7 +865,7 @@ class IndicesClient(NamespacedClient):
""" """
return self.transport.perform_request( return self.transport.perform_request(
"POST", "POST",
_make_path(index, doc_type, "_validate", "query"), _make_path(index, "_validate", "query"),
params=params, params=params,
headers=headers, headers=headers,
body=body, body=body,
-26
View File
@@ -249,34 +249,11 @@ class IndicesClient(NamespacedClient):
params: Optional[MutableMapping[str, Any]] = ..., params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ..., headers: Optional[MutableMapping[str, str]] = ...,
) -> bool: ... ) -> bool: ...
def exists_type(
self,
index: Any,
doc_type: Any,
*,
allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ...,
local: Optional[Any] = ...,
pretty: Optional[bool] = ...,
human: Optional[bool] = ...,
error_trace: Optional[bool] = ...,
format: Optional[str] = ...,
filter_path: Optional[Union[str, Collection[str]]] = ...,
request_timeout: Optional[Union[int, float]] = ...,
ignore: Optional[Union[int, Collection[int]]] = ...,
opaque_id: Optional[str] = ...,
http_auth: Optional[Union[str, Tuple[str, str]]] = ...,
api_key: Optional[Union[str, Tuple[str, str]]] = ...,
params: Optional[MutableMapping[str, Any]] = ...,
headers: Optional[MutableMapping[str, str]] = ...,
) -> bool: ...
def put_mapping( def put_mapping(
self, self,
*, *,
body: Any, body: Any,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
@@ -301,7 +278,6 @@ class IndicesClient(NamespacedClient):
self, self,
*, *,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
@@ -326,7 +302,6 @@ class IndicesClient(NamespacedClient):
fields: Any, fields: Any,
*, *,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
expand_wildcards: Optional[Any] = ..., expand_wildcards: Optional[Any] = ...,
ignore_unavailable: Optional[Any] = ..., ignore_unavailable: Optional[Any] = ...,
@@ -636,7 +611,6 @@ class IndicesClient(NamespacedClient):
*, *,
body: Optional[Any] = ..., body: Optional[Any] = ...,
index: Optional[Any] = ..., index: Optional[Any] = ...,
doc_type: Optional[Any] = ...,
all_shards: Optional[Any] = ..., all_shards: Optional[Any] = ...,
allow_no_indices: Optional[Any] = ..., allow_no_indices: Optional[Any] = ...,
analyze_wildcard: Optional[Any] = ..., analyze_wildcard: Optional[Any] = ...,
-1
View File
@@ -70,7 +70,6 @@ def expand_action(data):
"_retry_on_conflict", "_retry_on_conflict",
"_routing", "_routing",
"_timestamp", "_timestamp",
"_type",
"_version", "_version",
"_version_type", "_version_type",
"if_seq_no", "if_seq_no",
@@ -879,7 +879,6 @@ class TestParentChildReindex:
"_primary_term": 1, "_primary_term": 1,
"_seq_no": 0, "_seq_no": 0,
"_source": {"question_answer": "question"}, "_source": {"question_answer": "question"},
"_type": "_doc",
"_version": 1, "_version": 1,
"found": True, "found": True,
} == q } == q
@@ -895,7 +894,6 @@ class TestParentChildReindex:
"some": "data", "some": "data",
"question_answer": {"name": "answer", "parent": 42}, "question_answer": {"name": "answer", "parent": 42},
}, },
"_type": "_doc",
"_version": 1, "_version": 1,
"found": True, "found": True,
} == q } == q
@@ -44,7 +44,3 @@ class TestIndices(OpenSearchTestCase):
self.assertRaises(ValueError, self.client.indices.exists, index=None) self.assertRaises(ValueError, self.client.indices.exists, index=None)
self.assertRaises(ValueError, self.client.indices.exists, index=[]) self.assertRaises(ValueError, self.client.indices.exists, index=[])
self.assertRaises(ValueError, self.client.indices.exists, index="") self.assertRaises(ValueError, self.client.indices.exists, index="")
def test_put_mapping_without_index(self):
self.client.indices.put_mapping(doc_type="doc-type", body={})
self.assert_url_called("PUT", "/_all/doc-type/_mapping")
@@ -35,55 +35,30 @@ class TestOverriddenUrlTargets(OpenSearchTestCase):
self.client.create(index="test-index", id="test-id", body={}) self.client.create(index="test-index", id="test-id", body={})
self.assert_url_called("PUT", "/test-index/_create/test-id") self.assert_url_called("PUT", "/test-index/_create/test-id")
self.client.create(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("PUT", "/test-index/test-type/test-id/_create")
def test_delete(self): def test_delete(self):
self.client.delete(index="test-index", id="test-id") self.client.delete(index="test-index", id="test-id")
self.assert_url_called("DELETE", "/test-index/_doc/test-id") self.assert_url_called("DELETE", "/test-index/_doc/test-id")
self.client.delete(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("DELETE", "/test-index/test-type/test-id")
def test_exists(self): def test_exists(self):
self.client.exists(index="test-index", id="test-id") self.client.exists(index="test-index", id="test-id")
self.assert_url_called("HEAD", "/test-index/_doc/test-id") self.assert_url_called("HEAD", "/test-index/_doc/test-id")
self.client.exists(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("HEAD", "/test-index/test-type/test-id")
def test_explain(self): def test_explain(self):
self.client.explain(index="test-index", id="test-id") self.client.explain(index="test-index", id="test-id")
self.assert_url_called("POST", "/test-index/_explain/test-id") self.assert_url_called("POST", "/test-index/_explain/test-id")
self.client.explain(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("POST", "/test-index/test-type/test-id/_explain")
def test_get(self): def test_get(self):
self.client.get(index="test-index", id="test-id") self.client.get(index="test-index", id="test-id")
self.assert_url_called("GET", "/test-index/_doc/test-id") self.assert_url_called("GET", "/test-index/_doc/test-id")
self.client.get(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("GET", "/test-index/test-type/test-id")
def test_get_source(self): def test_get_source(self):
self.client.get_source(index="test-index", id="test-id") self.client.get_source(index="test-index", id="test-id")
self.assert_url_called("GET", "/test-index/_source/test-id") self.assert_url_called("GET", "/test-index/_source/test-id")
self.client.get_source(index="test-index", doc_type="test-type", id="test-id")
self.assert_url_called("GET", "/test-index/test-type/test-id/_source")
def test_exists_source(self): def test_exists_source(self):
self.client.exists_source(index="test-index", id="test-id") self.client.exists_source(index="test-index", id="test-id")
self.assert_url_called("HEAD", "/test-index/_source/test-id") self.assert_url_called("HEAD", "/test-index/_source/test-id")
self.client.exists_source(
index="test-index", doc_type="test-type", id="test-id"
)
self.assert_url_called("HEAD", "/test-index/test-type/test-id/_source")
def test_index(self): def test_index(self):
self.client.index(index="test-index", body={}) self.client.index(index="test-index", body={})
self.assert_url_called("POST", "/test-index/_doc") self.assert_url_called("POST", "/test-index/_doc")
@@ -91,20 +66,6 @@ class TestOverriddenUrlTargets(OpenSearchTestCase):
self.client.index(index="test-index", id="test-id", body={}) self.client.index(index="test-index", id="test-id", body={})
self.assert_url_called("PUT", "/test-index/_doc/test-id") self.assert_url_called("PUT", "/test-index/_doc/test-id")
self.client.index(index="test-index", doc_type="test-type", body={})
self.assert_url_called("POST", "/test-index/test-type")
self.client.index(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("PUT", "/test-index/test-type/test-id")
self.client.index(index="test-index", doc_type="_doc", body={})
self.assert_url_called("POST", "/test-index/_doc", count=2)
self.client.index(index="test-index", doc_type="_doc", id="test-id", body={})
self.assert_url_called("PUT", "/test-index/_doc/test-id", count=2)
def test_termvectors(self): def test_termvectors(self):
self.client.termvectors(index="test-index", body={}) self.client.termvectors(index="test-index", body={})
self.assert_url_called("POST", "/test-index/_termvectors") self.assert_url_called("POST", "/test-index/_termvectors")
@@ -112,30 +73,14 @@ class TestOverriddenUrlTargets(OpenSearchTestCase):
self.client.termvectors(index="test-index", id="test-id", body={}) self.client.termvectors(index="test-index", id="test-id", body={})
self.assert_url_called("POST", "/test-index/_termvectors/test-id") self.assert_url_called("POST", "/test-index/_termvectors/test-id")
self.client.termvectors(index="test-index", doc_type="test-type", body={})
self.assert_url_called("POST", "/test-index/test-type/_termvectors")
self.client.termvectors(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("POST", "/test-index/test-type/test-id/_termvectors")
def test_mtermvectors(self): def test_mtermvectors(self):
self.client.mtermvectors(index="test-index", body={}) self.client.mtermvectors(index="test-index", body={})
self.assert_url_called("POST", "/test-index/_mtermvectors") self.assert_url_called("POST", "/test-index/_mtermvectors")
self.client.mtermvectors(index="test-index", doc_type="test-type", body={})
self.assert_url_called("POST", "/test-index/test-type/_mtermvectors")
def test_update(self): def test_update(self):
self.client.update(index="test-index", id="test-id", body={}) self.client.update(index="test-index", id="test-id", body={})
self.assert_url_called("POST", "/test-index/_update/test-id") self.assert_url_called("POST", "/test-index/_update/test-id")
self.client.update(
index="test-index", doc_type="test-type", id="test-id", body={}
)
self.assert_url_called("POST", "/test-index/test-type/test-id/_update")
def test_cluster_state(self): def test_cluster_state(self):
self.client.cluster.state() self.client.cluster.state()
self.assert_url_called("GET", "/_cluster/state") self.assert_url_called("GET", "/_cluster/state")
@@ -155,19 +100,11 @@ class TestOverriddenUrlTargets(OpenSearchTestCase):
def test_indices_put_mapping(self): def test_indices_put_mapping(self):
self.client.indices.put_mapping(body={}) self.client.indices.put_mapping(body={})
self.assert_url_called("PUT", "/_mapping") self.assert_url_called("PUT", "/_all/_mapping")
self.client.indices.put_mapping(index="test-index", body={}) self.client.indices.put_mapping(index="test-index", body={})
self.assert_url_called("PUT", "/test-index/_mapping") self.assert_url_called("PUT", "/test-index/_mapping")
self.client.indices.put_mapping(
index="test-index", doc_type="test-type", body={}
)
self.assert_url_called("PUT", "/test-index/test-type/_mapping")
self.client.indices.put_mapping(doc_type="test-type", body={})
self.assert_url_called("PUT", "/_all/test-type/_mapping")
def test_tasks_get(self): def test_tasks_get(self):
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
self.client.tasks.get() self.client.tasks.get()
-1
View File
@@ -128,7 +128,6 @@ class TestChunkActions(TestCase):
"_index", "_index",
"_percolate", "_percolate",
"_timestamp", "_timestamp",
"_type",
"if_seq_no", "if_seq_no",
"if_primary_term", "if_primary_term",
"parent", "parent",
+17 -22
View File
@@ -97,12 +97,11 @@ class TestStreamingBulk(OpenSearchTestCase):
self.client.index(index="i", id=45, body={}) self.client.index(index="i", id=45, body={})
self.client.index(index="i", id=42, body={}) self.client.index(index="i", id=42, body={})
docs = [ docs = [
{"_index": "i", "_type": "_doc", "_id": 47, "f": "v"}, {"_index": "i", "_id": 47, "f": "v"},
{"_op_type": "delete", "_index": "i", "_type": "_doc", "_id": 45}, {"_op_type": "delete", "_index": "i", "_id": 45},
{ {
"_op_type": "update", "_op_type": "update",
"_index": "i", "_index": "i",
"_type": "_doc",
"_id": 42, "_id": 42,
"doc": {"answer": 42}, "doc": {"answer": 42},
}, },
@@ -117,9 +116,9 @@ class TestStreamingBulk(OpenSearchTestCase):
def test_transport_error_can_becaught(self): def test_transport_error_can_becaught(self):
failing_client = FailingBulkClient(self.client) failing_client = FailingBulkClient(self.client)
docs = [ docs = [
{"_index": "i", "_type": "_doc", "_id": 47, "f": "v"}, {"_index": "i", "_id": 47, "f": "v"},
{"_index": "i", "_type": "_doc", "_id": 45, "f": "v"}, {"_index": "i", "_id": 45, "f": "v"},
{"_index": "i", "_type": "_doc", "_id": 42, "f": "v"}, {"_index": "i", "_id": 42, "f": "v"},
] ]
results = list( results = list(
@@ -141,7 +140,6 @@ class TestStreamingBulk(OpenSearchTestCase):
{ {
"index": { "index": {
"_index": "i", "_index": "i",
"_type": "_doc",
"_id": 45, "_id": 45,
"data": {"f": "v"}, "data": {"f": "v"},
"error": "TransportError(599, 'Error!')", "error": "TransportError(599, 'Error!')",
@@ -156,9 +154,9 @@ class TestStreamingBulk(OpenSearchTestCase):
self.client, fail_with=TransportError(429, "Rejected!", {}) self.client, fail_with=TransportError(429, "Rejected!", {})
) )
docs = [ docs = [
{"_index": "i", "_type": "_doc", "_id": 47, "f": "v"}, {"_index": "i", "_id": 47, "f": "v"},
{"_index": "i", "_type": "_doc", "_id": 45, "f": "v"}, {"_index": "i", "_id": 45, "f": "v"},
{"_index": "i", "_type": "_doc", "_id": 42, "f": "v"}, {"_index": "i", "_id": 42, "f": "v"},
] ]
results = list( results = list(
helpers.streaming_bulk( helpers.streaming_bulk(
@@ -184,9 +182,9 @@ class TestStreamingBulk(OpenSearchTestCase):
) )
docs = [ docs = [
{"_index": "i", "_type": "_doc", "_id": 47, "f": "v"}, {"_index": "i", "_id": 47, "f": "v"},
{"_index": "i", "_type": "_doc", "_id": 45, "f": "v"}, {"_index": "i", "_id": 45, "f": "v"},
{"_index": "i", "_type": "_doc", "_id": 42, "f": "v"}, {"_index": "i", "_id": 42, "f": "v"},
] ]
results = list( results = list(
helpers.streaming_bulk( helpers.streaming_bulk(
@@ -286,7 +284,6 @@ class TestBulk(OpenSearchTestCase):
self.assertEqual(1, len(failed)) self.assertEqual(1, len(failed))
error = failed[0] error = failed[0]
self.assertEqual("42", error["index"]["_id"]) self.assertEqual("42", error["index"]["_id"])
self.assertEqual("_doc", error["index"]["_type"])
self.assertEqual("i", error["index"]["_index"]) self.assertEqual("i", error["index"]["_index"])
print(error["index"]["error"]) print(error["index"]["error"])
self.assertTrue( self.assertTrue(
@@ -387,7 +384,7 @@ class TestScan(OpenSearchTestCase):
def test_order_can_be_preserved(self): def test_order_can_be_preserved(self):
bulk = [] bulk = []
for x in range(100): for x in range(100):
bulk.append({"index": {"_index": "test_index", "_type": "_doc", "_id": x}}) bulk.append({"index": {"_index": "test_index", "_id": x}})
bulk.append({"answer": x, "correct": x == 42}) bulk.append({"answer": x, "correct": x == 42})
self.client.bulk(bulk, refresh=True) self.client.bulk(bulk, refresh=True)
@@ -407,7 +404,7 @@ class TestScan(OpenSearchTestCase):
def test_all_documents_are_read(self): def test_all_documents_are_read(self):
bulk = [] bulk = []
for x in range(100): for x in range(100):
bulk.append({"index": {"_index": "test_index", "_type": "_doc", "_id": x}}) bulk.append({"index": {"_index": "test_index", "_id": x}})
bulk.append({"answer": x, "correct": x == 42}) bulk.append({"answer": x, "correct": x == 42})
self.client.bulk(bulk, refresh=True) self.client.bulk(bulk, refresh=True)
@@ -420,7 +417,7 @@ class TestScan(OpenSearchTestCase):
def test_scroll_error(self): def test_scroll_error(self):
bulk = [] bulk = []
for x in range(4): for x in range(4):
bulk.append({"index": {"_index": "test_index", "_type": "_doc"}}) bulk.append({"index": {"_index": "test_index"}})
bulk.append({"value": x}) bulk.append({"value": x})
self.client.bulk(bulk, refresh=True) self.client.bulk(bulk, refresh=True)
@@ -554,7 +551,7 @@ class TestScan(OpenSearchTestCase):
def test_logger(self, logger_mock): def test_logger(self, logger_mock):
bulk = [] bulk = []
for x in range(4): for x in range(4):
bulk.append({"index": {"_index": "test_index", "_type": "_doc"}}) bulk.append({"index": {"_index": "test_index"}})
bulk.append({"value": x}) bulk.append({"value": x})
self.client.bulk(bulk, refresh=True) self.client.bulk(bulk, refresh=True)
@@ -589,7 +586,7 @@ class TestScan(OpenSearchTestCase):
def test_clear_scroll(self): def test_clear_scroll(self):
bulk = [] bulk = []
for x in range(4): for x in range(4):
bulk.append({"index": {"_index": "test_index", "_type": "_doc"}}) bulk.append({"index": {"_index": "test_index"}})
bulk.append({"value": x}) bulk.append({"value": x})
self.client.bulk(bulk, refresh=True) self.client.bulk(bulk, refresh=True)
@@ -645,7 +642,7 @@ class TestReindex(OpenSearchTestCase):
def setup_method(self, _): def setup_method(self, _):
bulk = [] bulk = []
for x in range(100): for x in range(100):
bulk.append({"index": {"_index": "test_index", "_type": "_doc", "_id": x}}) bulk.append({"index": {"_index": "test_index", "_id": x}})
bulk.append( bulk.append(
{ {
"answer": x, "answer": x,
@@ -749,7 +746,6 @@ class TestParentChildReindex(OpenSearchTestCase):
"_primary_term": 1, "_primary_term": 1,
"_seq_no": 0, "_seq_no": 0,
"_source": {"question_answer": "question"}, "_source": {"question_answer": "question"},
"_type": "_doc",
"_version": 1, "_version": 1,
"found": True, "found": True,
}, },
@@ -767,7 +763,6 @@ class TestParentChildReindex(OpenSearchTestCase):
"some": "data", "some": "data",
"question_answer": {"name": "answer", "parent": 42}, "question_answer": {"name": "answer", "parent": 42},
}, },
"_type": "_doc",
"_version": 1, "_version": 1,
"found": True, "found": True,
}, },
+1 -4
View File
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_create", id)
path = _make_path(index, "_create", id)
else:
path = _make_path(index, doc_type, id, "_create")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %} {% endblock %}
+1 -2
View File
@@ -1,7 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
{{ super()|trim }} {{ super()|trim }}
{% endblock %} {% endblock %}
+1 -2
View File
@@ -1,7 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
{{ super()|trim }} {{ super()|trim }}
{% endblock %} {% endblock %}
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_source", id)
path = _make_path(index, "_source", id)
else:
path = _make_path(index, doc_type, id, "_source")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers)
{% endblock %} {% endblock %}
+1 -4
View File
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_explain", id)
path = _make_path(index, "_explain", id)
else:
path = _make_path(index, doc_type, id, "_explain")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %} {% endblock %}
+1 -2
View File
@@ -1,7 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: doc_type = "_doc"
doc_type = "_doc"
{{ super()|trim }} {{ super()|trim }}
{% endblock %} {% endblock %}
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_source", id)
path = _make_path(index, "_source", id)
else:
path = _make_path(index, doc_type, id, "_source")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers)
{% endblock %} {% endblock %}
+1 -3
View File
@@ -1,8 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type is None: doc_type = "_doc"
doc_type = "_doc"
return await self.transport.perform_request("POST" if id in SKIP_IN_PATH else "PUT", {% include "url" %}, params=params, headers=headers, body=body) return await self.transport.perform_request("POST" if id in SKIP_IN_PATH else "PUT", {% include "url" %}, params=params, headers=headers, body=body)
{% endblock %} {% endblock %}
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_mtermvectors")
path = _make_path(index, "_mtermvectors")
else:
path = _make_path(index, doc_type, "_mtermvectors")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %} {% endblock %}
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_termvectors", id)
path = _make_path(index, "_termvectors", id)
else:
path = _make_path(index, doc_type, id, "_termvectors")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %} {% endblock %}
+1 -4
View File
@@ -1,9 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type in SKIP_IN_PATH: path = _make_path(index, "_update", id)
path = _make_path(index, "_update", id)
else:
path = _make_path(index, doc_type, id, "_update")
return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body) return await self.transport.perform_request("{{ api.method }}", path, params=params, headers=headers, body=body)
{% endblock %} {% endblock %}
@@ -1,6 +1,6 @@
{% extends "base" %} {% extends "base" %}
{% block request %} {% block request %}
if doc_type not in SKIP_IN_PATH and index in SKIP_IN_PATH: if index in SKIP_IN_PATH:
index = "_all" index = "_all"
{{ super()|trim }} {{ super()|trim }}