Commit 7ea918f8 authored by litaolemo's avatar litaolemo

update

parent 3e259101
......@@ -9,9 +9,10 @@
6. 写入抓取url程序 python /srv/apps/crawler/crawler_sys/framework/write_releasers_to_redis.py -p weibo -d 1 -proxies 2
7.
##搜索页爬虫
pass
python /srv/apps/crawler/crawler_sys/framework/search_page_single_process.py
## 数据周报
1. 切换权限 sudo su - gmuser
2. source /root/anaconda3/bin/activate
3. python crawler/crawler_sys/utils/get_query_result.py
\ No newline at end of file
3. python crawler/crawler_sys/utils/get_query_result.py
/opt/spark/bin/spark-submit --master yarn --deploy-mode client --queue root.strategy --driver-memory 16g --executor-memory 1g --executor-cores 1 --num-executors 70 --conf spark.default.parallelism=100 --conf spark.storage.memoryFraction=0.5 --conf spark.shuffle.memoryFraction=0.3 --conf spark.executorEnv.LD_LIBRARY_PATH="/opt/java/jdk1.8.0_181/jre/lib/amd64/server:/opt/cloudera/parcels/CDH-5.16.1-1.cdh5.16.1.p0.3/lib64" --conf spark.locality.wait=0 --jars /srv/apps/tispark-core-2.1-SNAPSHOT-jar-with-dependencies.jar,/srv/apps/spark-connector_2.11-1.9.0-rc2.jar,/srv/apps/mysql-connector-java-5.1.38.jar /srv/apps/crawler/tasks/crawler_week_report.py
\ No newline at end of file
......@@ -4,7 +4,6 @@ Created on Tue Dec 4 14:00:03 2018
@author: fangyucheng
"""
import argparse
import configparser
import random
......
......@@ -189,6 +189,10 @@ def write_data_into_mysql(res_data: Dict, user_id_list: List):
platform_value = 14
elif data["platform"] == "toutiao":
platform_value = 13
elif data["platform"] == "xiaohongshu":
platform_value = 15
elif data["platform"] == "xinyang":
platform_value = 16
try:
sql_query = """insert into api_tractate
......
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
# flake8: noqa
from __future__ import absolute_import
VERSION = (7, 8, 0)
__version__ = VERSION
__versionstr__ = "7.8.0"
import sys
import logging
import warnings
logger = logging.getLogger("elasticsearch")
logger.addHandler(logging.NullHandler())
from .client import Elasticsearch
from .transport import Transport
from .connection_pool import ConnectionPool, ConnectionSelector, RoundRobinSelector
from .serializer import JSONSerializer
from .connection import Connection, RequestsHttpConnection, Urllib3HttpConnection
from .exceptions import (
ImproperlyConfigured,
ElasticsearchException,
SerializationError,
TransportError,
NotFoundError,
ConflictError,
RequestError,
ConnectionError,
SSLError,
ConnectionTimeout,
AuthenticationException,
AuthorizationException,
ElasticsearchDeprecationWarning,
)
# Only raise one warning per deprecation message so as not
# to spam up the user if the same action is done multiple times.
warnings.simplefilter("default", category=ElasticsearchDeprecationWarning, append=True)
__all__ = [
"Elasticsearch",
"Transport",
"ConnectionPool",
"ConnectionSelector",
"RoundRobinSelector",
"JSONSerializer",
"Connection",
"RequestsHttpConnection",
"Urllib3HttpConnection",
"ImproperlyConfigured",
"ElasticsearchException",
"SerializationError",
"TransportError",
"NotFoundError",
"ConflictError",
"RequestError",
"ConnectionError",
"SSLError",
"ConnectionTimeout",
"AuthenticationException",
"AuthorizationException",
"ElasticsearchDeprecationWarning",
]
try:
# Asyncio only supported on Python 3.6+
if sys.version_info < (3, 6):
raise ImportError
from ._async.http_aiohttp import AIOHttpConnection
from ._async.transport import AsyncTransport
from ._async.client import AsyncElasticsearch
__all__ += ["AIOHttpConnection", "AsyncTransport", "AsyncElasticsearch"]
except (ImportError, SyntaxError):
pass
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
class AsyncSearchClient(NamespacedClient):
@query_params()
async def delete(self, id, params=None, headers=None):
"""
Deletes an async search by ID. If the search is still running, the search
request will be cancelled. Otherwise, the saved search results are deleted.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/async-search.html>`_
:arg id: The async search ID
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"DELETE", _make_path("_async_search", id), params=params, headers=headers
)
@query_params("keep_alive", "typed_keys", "wait_for_completion_timeout")
async def get(self, id, params=None, headers=None):
"""
Retrieves the results of a previously submitted async search request given its
ID.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/async-search.html>`_
:arg id: The async search ID
:arg keep_alive: Specify the time interval in which the results
(partial or final) for this search will be available
:arg typed_keys: Specify whether aggregation and suggester names
should be prefixed by their respective types in the response
:arg wait_for_completion_timeout: Specify the time that the
request should block waiting for the final response
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"GET", _make_path("_async_search", id), params=params, headers=headers
)
@query_params(
"_source",
"_source_excludes",
"_source_includes",
"allow_no_indices",
"allow_partial_search_results",
"analyze_wildcard",
"analyzer",
"batched_reduce_size",
"default_operator",
"df",
"docvalue_fields",
"expand_wildcards",
"explain",
"from_",
"ignore_throttled",
"ignore_unavailable",
"keep_alive",
"keep_on_completion",
"lenient",
"max_concurrent_shard_requests",
"preference",
"q",
"request_cache",
"routing",
"search_type",
"seq_no_primary_term",
"size",
"sort",
"stats",
"stored_fields",
"suggest_field",
"suggest_mode",
"suggest_size",
"suggest_text",
"terminate_after",
"timeout",
"track_scores",
"track_total_hits",
"typed_keys",
"version",
"wait_for_completion_timeout",
)
async def submit(self, body=None, index=None, params=None, headers=None):
"""
Executes a search request asynchronously.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/async-search.html>`_
:arg body: The search definition using the Query DSL
:arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices
:arg _source: True or false to return the _source field or not,
or a list of fields to return
:arg _source_excludes: A list of fields to exclude from the
returned _source field
:arg _source_includes: A list of fields to extract and return
from the _source field
: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 allow_partial_search_results: Indicate if an error should
be returned if there is a partial search failure or timeout Default:
True
:arg analyze_wildcard: Specify whether wildcard and prefix
queries should be analyzed (default: false)
:arg analyzer: The analyzer to use for the query string
:arg batched_reduce_size: The number of shard results that
should be reduced at once on the coordinating node. This value should be
used as the granularity at which progress results will be made
available. Default: 5
:arg default_operator: The default operator for query string
query (AND or OR) Valid choices: AND, OR Default: OR
:arg df: The field to use as default where no field prefix is
given in the query string
:arg docvalue_fields: A comma-separated list of fields to return
as the docvalue representation of a field for each hit
: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 explain: Specify whether to return detailed information
about score computation as part of a hit
:arg from_: Starting offset (default: 0)
:arg ignore_throttled: Whether specified concrete, expanded or
aliased indices should be ignored when throttled
:arg ignore_unavailable: Whether specified concrete indices
should be ignored when unavailable (missing or closed)
:arg keep_alive: Update the time interval in which the results
(partial or final) for this search will be available Default: 5d
:arg keep_on_completion: Control whether the response should be
stored in the cluster if it completed within the provided
[wait_for_completion] time (default: false)
:arg lenient: Specify whether format-based query failures (such
as providing text to a numeric field) should be ignored
:arg max_concurrent_shard_requests: The number of concurrent
shard requests per node this search executes concurrently. This value
should be used to limit the impact of the search on the cluster in order
to limit the number of concurrent shard requests Default: 5
:arg preference: Specify the node or shard the operation should
be performed on (default: random)
:arg q: Query in the Lucene query string syntax
:arg request_cache: Specify if request cache should be used for
this request or not, defaults to true
:arg routing: A comma-separated list of specific routing values
:arg search_type: Search operation type Valid choices:
query_then_fetch, dfs_query_then_fetch
:arg seq_no_primary_term: Specify whether to return sequence
number and primary term of the last modification of each hit
:arg size: Number of hits to return (default: 10)
:arg sort: A comma-separated list of <field>:<direction> pairs
:arg stats: Specific 'tag' of the request for logging and
statistical purposes
:arg stored_fields: A comma-separated list of stored fields to
return as part of a hit
:arg suggest_field: Specify which field to use for suggestions
:arg suggest_mode: Specify suggest mode Valid choices: missing,
popular, always Default: missing
:arg suggest_size: How many suggestions to return in response
:arg suggest_text: The source text for which the suggestions
should be returned
:arg terminate_after: The maximum number of documents to collect
for each shard, upon reaching which the query execution will terminate
early.
:arg timeout: Explicit operation timeout
:arg track_scores: Whether to calculate and return scores even
if they are not used for sorting
:arg track_total_hits: Indicate if the number of documents that
match the query should be tracked
:arg typed_keys: Specify whether aggregation and suggester names
should be prefixed by their respective types in the response
:arg version: Specify whether to return document version as part
of a hit
:arg wait_for_completion_timeout: Specify the time that the
request should block waiting for the final response Default: 1s
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
params["from"] = params.pop("from_")
return await self.transport.perform_request(
"POST",
_make_path(index, "_async_search"),
params=params,
headers=headers,
body=body,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, SKIP_IN_PATH, _make_path
class AutoscalingClient(NamespacedClient):
@query_params()
async def get_autoscaling_decision(self, params=None, headers=None):
"""
Gets the current autoscaling decision based on the configured autoscaling
policy, indicating whether or not autoscaling is needed.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-decision.html>`_
"""
return await self.transport.perform_request(
"GET", "/_autoscaling/decision", params=params, headers=headers
)
@query_params()
async def delete_autoscaling_policy(self, name, params=None, headers=None):
"""
Deletes an autoscaling policy.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-delete-autoscaling-policy.html>`_
:arg name: the name of the autoscaling policy
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return await self.transport.perform_request(
"DELETE",
_make_path("_autoscaling", "policy", name),
params=params,
headers=headers,
)
@query_params()
async def put_autoscaling_policy(self, name, body, params=None, headers=None):
"""
Creates a new autoscaling policy.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-put-autoscaling-policy.html>`_
:arg name: the name of the autoscaling policy
:arg body: the specification of the autoscaling policy
"""
for param in (name, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path("_autoscaling", "policy", name),
params=params,
headers=headers,
body=body,
)
@query_params()
async def get_autoscaling_policy(self, name, params=None, headers=None):
"""
Retrieves an autoscaling policy.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/autoscaling-get-autoscaling-policy.html>`_
:arg name: the name of the autoscaling policy
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return await self.transport.perform_request(
"GET",
_make_path("_autoscaling", "policy", name),
params=params,
headers=headers,
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class Data_FrameClient(NamespacedClient):
@query_params()
async def delete_data_frame_transform(
self, transform_id, params=None, headers=None
):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/delete-data-frame-transform.html>`_
:arg transform_id: The id of the transform to delete
"""
if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)
return await self.transport.perform_request(
"DELETE",
_make_path("_data_frame", "transforms", transform_id),
params=params,
headers=headers,
)
@query_params("from_", "size")
async def get_data_frame_transform(
self, transform_id=None, params=None, headers=None
):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-data-frame-transform.html>`_
:arg transform_id: The id or comma delimited list of id expressions of
the transforms to get, '_all' or '*' implies get all transforms
:arg from_: skips a number of transform configs, defaults to 0
:arg size: specifies a max number of transforms to get, defaults to 100
"""
return await self.transport.perform_request(
"GET",
_make_path("_data_frame", "transforms", transform_id),
params=params,
headers=headers,
)
@query_params()
async def get_data_frame_transform_stats(
self, transform_id=None, params=None, headers=None
):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-data-frame-transform-stats.html>`_
:arg transform_id: The id of the transform for which to get stats.
'_all' or '*' implies all transforms
"""
return await self.transport.perform_request(
"GET",
_make_path("_data_frame", "transforms", transform_id, "_stats"),
params=params,
headers=headers,
)
@query_params()
async def preview_data_frame_transform(self, body, params=None, headers=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/preview-data-frame-transform.html>`_
:arg body: The definition for the data_frame transform to preview
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST",
"/_data_frame/transforms/_preview",
params=params,
headers=headers,
body=body,
)
@query_params()
async def put_data_frame_transform(
self, transform_id, body, params=None, headers=None
):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/put-data-frame-transform.html>`_
:arg transform_id: The id of the new transform.
:arg body: The data frame transform definition
"""
for param in (transform_id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"PUT",
_make_path("_data_frame", "transforms", transform_id),
params=params,
headers=headers,
body=body,
)
@query_params("timeout")
async def start_data_frame_transform(self, transform_id, params=None, headers=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/start-data-frame-transform.html>`_
:arg transform_id: The id of the transform to start
:arg timeout: Controls the time to wait for the transform to start
"""
if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)
return await self.transport.perform_request(
"POST",
_make_path("_data_frame", "transforms", transform_id, "_start"),
params=params,
headers=headers,
)
@query_params("timeout", "wait_for_completion")
async def stop_data_frame_transform(self, transform_id, params=None, headers=None):
"""
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.x/stop-data-frame-transform.html>`_
:arg transform_id: The id of the transform to stop
:arg timeout: Controls the time to wait until the transform has stopped.
Default to 30 seconds
:arg wait_for_completion: Whether to wait for the transform to fully
stop before returning or not. Default to false
"""
if transform_id in SKIP_IN_PATH:
raise ValueError(
"Empty value passed for a required argument 'transform_id'."
)
return await self.transport.perform_request(
"POST",
_make_path("_data_frame", "transforms", transform_id, "_stop"),
params=params,
headers=headers,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path
class DeprecationClient(NamespacedClient):
@query_params()
async def info(self, index=None, params=None, headers=None):
"""
`<http://www.elastic.co/guide/en/migration/7.x/migration-api-deprecation.html>`_
:arg index: Index pattern
"""
return await self.transport.perform_request(
"GET",
_make_path(index, "_xpack", "migration", "deprecations"),
params=params,
headers=headers,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class EnrichClient(NamespacedClient):
@query_params()
async def delete_policy(self, name, params=None, headers=None):
"""
Deletes an existing enrich policy and its enrich index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/delete-enrich-policy-api.html>`_
:arg name: The name of the enrich policy
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return await self.transport.perform_request(
"DELETE",
_make_path("_enrich", "policy", name),
params=params,
headers=headers,
)
@query_params("wait_for_completion")
async def execute_policy(self, name, params=None, headers=None):
"""
Creates the enrich index for an existing enrich policy.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/execute-enrich-policy-api.html>`_
:arg name: The name of the enrich policy
:arg wait_for_completion: Should the request should block until
the execution is complete. Default: True
"""
if name in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'name'.")
return await self.transport.perform_request(
"PUT",
_make_path("_enrich", "policy", name, "_execute"),
params=params,
headers=headers,
)
@query_params()
async def get_policy(self, name=None, params=None, headers=None):
"""
Gets information about an enrich policy.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/get-enrich-policy-api.html>`_
:arg name: A comma-separated list of enrich policy names
"""
return await self.transport.perform_request(
"GET", _make_path("_enrich", "policy", name), params=params, headers=headers
)
@query_params()
async def put_policy(self, name, body, params=None, headers=None):
"""
Creates a new enrich policy.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/put-enrich-policy-api.html>`_
:arg name: The name of the enrich policy
:arg body: The enrich policy to register
"""
for param in (name, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path("_enrich", "policy", name),
params=params,
headers=headers,
body=body,
)
@query_params()
async def stats(self, params=None, headers=None):
"""
Gets enrich coordinator statistics and information about enrich policies that
are currently executing.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/enrich-stats-api.html>`_
"""
return await self.transport.perform_request(
"GET", "/_enrich/_stats", params=params, headers=headers
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, SKIP_IN_PATH, query_params, _make_path
class EqlClient(NamespacedClient):
@query_params()
async def search(self, index, body, params=None, headers=None):
"""
Returns results matching a query expressed in Event Query Language (EQL)
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search-api.html>`_
:arg index: The name of the index to scope the operation
:arg body: Eql request body. Use the `query` to limit the query
scope.
"""
for param in (index, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"POST",
_make_path(index, "_eql", "search"),
params=params,
headers=headers,
body=body,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class GraphClient(NamespacedClient):
@query_params("routing", "timeout")
async def explore(self, index, body=None, doc_type=None, params=None, headers=None):
"""
Explore extracted and summarized information about the documents and terms in
an index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/graph-explore-api.html>`_
:arg index: A comma-separated list of index names to search; use
`_all` or empty string to perform the operation on all indices
:arg body: Graph Query DSL
:arg doc_type: A comma-separated list of document types to
search; leave empty to perform the operation on all types
:arg routing: Specific routing value
:arg timeout: Explicit operation timeout
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"POST",
_make_path(index, doc_type, "_graph", "explore"),
params=params,
headers=headers,
body=body,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class IlmClient(NamespacedClient):
@query_params()
async def delete_lifecycle(self, policy, params=None, headers=None):
"""
Deletes the specified lifecycle policy definition. A currently used policy
cannot be deleted.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-delete-lifecycle.html>`_
:arg policy: The name of the index lifecycle policy
"""
if policy in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'policy'.")
return await self.transport.perform_request(
"DELETE",
_make_path("_ilm", "policy", policy),
params=params,
headers=headers,
)
@query_params("only_errors", "only_managed")
async def explain_lifecycle(self, index, params=None, headers=None):
"""
Retrieves information about the index's current lifecycle state, such as the
currently executing phase, action, and step.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-explain-lifecycle.html>`_
:arg index: The name of the index to explain
:arg only_errors: filters the indices included in the response
to ones in an ILM error state, implies only_managed
:arg only_managed: filters the indices included in the response
to ones managed by ILM
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"GET", _make_path(index, "_ilm", "explain"), params=params, headers=headers
)
@query_params()
async def get_lifecycle(self, policy=None, params=None, headers=None):
"""
Returns the specified policy definition. Includes the policy version and last
modified date.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-get-lifecycle.html>`_
:arg policy: The name of the index lifecycle policy
"""
return await self.transport.perform_request(
"GET", _make_path("_ilm", "policy", policy), params=params, headers=headers
)
@query_params()
async def get_status(self, params=None, headers=None):
"""
Retrieves the current index lifecycle management (ILM) status.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-get-status.html>`_
"""
return await self.transport.perform_request(
"GET", "/_ilm/status", params=params, headers=headers
)
@query_params()
async def move_to_step(self, index, body=None, params=None, headers=None):
"""
Manually moves an index into the specified step and executes that step.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-move-to-step.html>`_
:arg index: The name of the index whose lifecycle step is to
change
:arg body: The new lifecycle step to move to
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"POST",
_make_path("_ilm", "move", index),
params=params,
headers=headers,
body=body,
)
@query_params()
async def put_lifecycle(self, policy, body=None, params=None, headers=None):
"""
Creates a lifecycle policy
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-put-lifecycle.html>`_
:arg policy: The name of the index lifecycle policy
:arg body: The lifecycle policy definition to register
"""
if policy in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'policy'.")
return await self.transport.perform_request(
"PUT",
_make_path("_ilm", "policy", policy),
params=params,
headers=headers,
body=body,
)
@query_params()
async def remove_policy(self, index, params=None, headers=None):
"""
Removes the assigned lifecycle policy and stops managing the specified index
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-remove-policy.html>`_
:arg index: The name of the index to remove policy on
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"POST", _make_path(index, "_ilm", "remove"), params=params, headers=headers
)
@query_params()
async def retry(self, index, params=None, headers=None):
"""
Retries executing the policy for an index that is in the ERROR step.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-retry-policy.html>`_
:arg index: The name of the indices (comma-separated) whose
failed lifecycle step is to be retry
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"POST", _make_path(index, "_ilm", "retry"), params=params, headers=headers
)
@query_params()
async def start(self, params=None, headers=None):
"""
Start the index lifecycle management (ILM) plugin.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-start.html>`_
"""
return await self.transport.perform_request(
"POST", "/_ilm/start", params=params, headers=headers
)
@query_params()
async def stop(self, params=None, headers=None):
"""
Halts all lifecycle management operations and stops the index lifecycle
management (ILM) plugin
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ilm-stop.html>`_
"""
return await self.transport.perform_request(
"POST", "/_ilm/stop", params=params, headers=headers
)
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class IngestClient(NamespacedClient):
@query_params("master_timeout")
async def get_pipeline(self, id=None, params=None, headers=None):
"""
Returns a pipeline.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/get-pipeline-api.html>`_
:arg id: Comma separated list of pipeline ids. Wildcards
supported
:arg master_timeout: Explicit operation timeout for connection
to master node
"""
return await self.transport.perform_request(
"GET", _make_path("_ingest", "pipeline", id), params=params, headers=headers
)
@query_params("master_timeout", "timeout")
async def put_pipeline(self, id, body, params=None, headers=None):
"""
Creates or updates a pipeline.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/put-pipeline-api.html>`_
:arg id: Pipeline ID
:arg body: The ingest definition
:arg master_timeout: Explicit operation timeout for connection
to master node
:arg timeout: Explicit operation timeout
"""
for param in (id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path("_ingest", "pipeline", id),
params=params,
headers=headers,
body=body,
)
@query_params("master_timeout", "timeout")
async def delete_pipeline(self, id, params=None, headers=None):
"""
Deletes a pipeline.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/delete-pipeline-api.html>`_
:arg id: Pipeline ID
:arg master_timeout: Explicit operation timeout for connection
to master node
:arg timeout: Explicit operation timeout
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"DELETE",
_make_path("_ingest", "pipeline", id),
params=params,
headers=headers,
)
@query_params("verbose")
async def simulate(self, body, id=None, params=None, headers=None):
"""
Allows to simulate a pipeline with example documents.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/simulate-pipeline-api.html>`_
:arg body: The simulate definition
:arg id: Pipeline ID
:arg verbose: Verbose mode. Display data output for each
processor in executed pipeline
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return await self.transport.perform_request(
"POST",
_make_path("_ingest", "pipeline", id, "_simulate"),
params=params,
headers=headers,
body=body,
)
@query_params()
async def processor_grok(self, params=None, headers=None):
"""
Returns a list of the built-in patterns.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/grok-processor.html#grok-processor-rest-get>`_
"""
return await self.transport.perform_request(
"GET", "/_ingest/processor/grok", params=params, headers=headers
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params
class LicenseClient(NamespacedClient):
@query_params()
async def delete(self, params=None, headers=None):
"""
Deletes licensing information for the cluster
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/delete-license.html>`_
"""
return await self.transport.perform_request(
"DELETE", "/_license", params=params, headers=headers
)
@query_params("accept_enterprise", "local")
async def get(self, params=None, headers=None):
"""
Retrieves licensing information for the cluster
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/get-license.html>`_
:arg accept_enterprise: If the active license is an enterprise
license, return type as 'enterprise' (default: false)
:arg local: Return local information, do not retrieve the state
from master node (default: false)
"""
return await self.transport.perform_request(
"GET", "/_license", params=params, headers=headers
)
@query_params()
async def get_basic_status(self, params=None, headers=None):
"""
Retrieves information about the status of the basic license.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/get-basic-status.html>`_
"""
return await self.transport.perform_request(
"GET", "/_license/basic_status", params=params, headers=headers
)
@query_params()
async def get_trial_status(self, params=None, headers=None):
"""
Retrieves information about the status of the trial license.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/get-trial-status.html>`_
"""
return await self.transport.perform_request(
"GET", "/_license/trial_status", params=params, headers=headers
)
@query_params("acknowledge")
async def post(self, body=None, params=None, headers=None):
"""
Updates the license for the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/update-license.html>`_
:arg body: licenses to be installed
:arg acknowledge: whether the user has acknowledged acknowledge
messages (default: false)
"""
return await self.transport.perform_request(
"PUT", "/_license", params=params, headers=headers, body=body
)
@query_params("acknowledge")
async def post_start_basic(self, params=None, headers=None):
"""
Starts an indefinite basic license.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/start-basic.html>`_
:arg acknowledge: whether the user has acknowledged acknowledge
messages (default: false)
"""
return await self.transport.perform_request(
"POST", "/_license/start_basic", params=params, headers=headers
)
@query_params("acknowledge", "doc_type")
async def post_start_trial(self, params=None, headers=None):
"""
starts a limited time trial license.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/start-trial.html>`_
:arg acknowledge: whether the user has acknowledged acknowledge
messages (default: false)
:arg doc_type: The type of trial license to generate (default:
"trial")
"""
# type is a reserved word so it cannot be used, use doc_type instead
if "doc_type" in params:
params["type"] = params.pop("doc_type")
return await self.transport.perform_request(
"POST", "/_license/start_trial", params=params, headers=headers
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path
class MigrationClient(NamespacedClient):
@query_params()
async def deprecations(self, index=None, params=None, headers=None):
"""
Retrieves information about different cluster, node, and index level settings
that use deprecated features that will be removed or changed in the next major
version.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/migration-api-deprecation.html>`_
:arg index: Index pattern
"""
return await self.transport.perform_request(
"GET",
_make_path(index, "_migration", "deprecations"),
params=params,
headers=headers,
)
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH, _bulk_body
class MonitoringClient(NamespacedClient):
@query_params("interval", "system_api_version", "system_id")
async def bulk(self, body, doc_type=None, params=None, headers=None):
"""
Used by the monitoring features to send monitoring data.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/monitor-elasticsearch-cluster.html>`_
:arg body: The operation definition and data (action-data
pairs), separated by newlines
:arg doc_type: Default document type for items which don't
provide one
:arg interval: Collection interval (e.g., '10s' or '10000ms') of
the payload
:arg system_api_version: API Version of the monitored system
:arg system_id: Identifier of the monitored system
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
body = _bulk_body(self.transport.serializer, body)
return await self.transport.perform_request(
"POST",
_make_path("_monitoring", doc_type, "bulk"),
params=params,
headers=headers,
body=body,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path
class NodesClient(NamespacedClient):
@query_params("timeout")
async def reload_secure_settings(
self, body=None, node_id=None, params=None, headers=None
):
"""
Reloads secure settings.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/secure-settings.html#reloadable-secure-settings>`_
:arg body: An object containing the password for the
elasticsearch keystore
:arg node_id: A comma-separated list of node IDs to span the
reload/reinit call. Should stay empty because reloading usually involves
all cluster nodes.
:arg timeout: Explicit operation timeout
"""
return await self.transport.perform_request(
"POST",
_make_path("_nodes", node_id, "reload_secure_settings"),
params=params,
headers=headers,
body=body,
)
@query_params("flat_settings", "timeout")
async def info(self, node_id=None, metric=None, params=None, headers=None):
"""
Returns information about nodes in the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/cluster-nodes-info.html>`_
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg metric: A comma-separated list of metrics you wish
returned. Leave empty to return all. Valid choices: settings, os,
process, jvm, thread_pool, transport, http, plugins, ingest
:arg flat_settings: Return settings in flat format (default:
false)
:arg timeout: Explicit operation timeout
"""
return await self.transport.perform_request(
"GET", _make_path("_nodes", node_id, metric), params=params, headers=headers
)
@query_params(
"doc_type", "ignore_idle_threads", "interval", "snapshots", "threads", "timeout"
)
async def hot_threads(self, node_id=None, params=None, headers=None):
"""
Returns information about hot threads on each node in the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/cluster-nodes-hot-threads.html>`_
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg doc_type: The type to sample (default: cpu) Valid choices:
cpu, wait, block
:arg ignore_idle_threads: Don't show threads that are in known-
idle places, such as waiting on a socket select or pulling from an empty
task queue (default: true)
:arg interval: The interval for the second sampling of threads
:arg snapshots: Number of samples of thread stacktrace (default:
10)
:arg threads: Specify the number of threads to provide
information for (default: 3)
:arg timeout: Explicit operation timeout
"""
# type is a reserved word so it cannot be used, use doc_type instead
if "doc_type" in params:
params["type"] = params.pop("doc_type")
return await self.transport.perform_request(
"GET",
_make_path("_nodes", node_id, "hot_threads"),
params=params,
headers=headers,
)
@query_params("timeout")
async def usage(self, node_id=None, metric=None, params=None, headers=None):
"""
Returns low-level information about REST actions usage on nodes.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/cluster-nodes-usage.html>`_
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg metric: Limit the information returned to the specified
metrics Valid choices: _all, rest_actions
:arg timeout: Explicit operation timeout
"""
return await self.transport.perform_request(
"GET",
_make_path("_nodes", node_id, "usage", metric),
params=params,
headers=headers,
)
@query_params(
"completion_fields",
"fielddata_fields",
"fields",
"groups",
"include_segment_file_sizes",
"level",
"timeout",
"types",
)
async def stats(
self, node_id=None, metric=None, index_metric=None, params=None, headers=None
):
"""
Returns statistical information about nodes in the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/cluster-nodes-stats.html>`_
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information; use `_local` to return information from
the node you're connecting to, leave empty to get information from all
nodes
:arg metric: Limit the information returned to the specified
metrics Valid choices: _all, breaker, fs, http, indices, jvm, os,
process, thread_pool, transport, discovery
:arg index_metric: Limit the information returned for `indices`
metric to the specific index metrics. Isn't used if `indices` (or `all`)
metric isn't specified. Valid choices: _all, completion, docs,
fielddata, query_cache, flush, get, indexing, merge, request_cache,
refresh, search, segments, store, warmer, suggest
:arg completion_fields: A comma-separated list of fields for
`fielddata` and `suggest` index metric (supports wildcards)
:arg fielddata_fields: A comma-separated list of fields for
`fielddata` index metric (supports wildcards)
:arg fields: A comma-separated list of fields for `fielddata`
and `completion` index metric (supports wildcards)
:arg groups: A comma-separated list of search groups for
`search` index metric
:arg include_segment_file_sizes: Whether to report the
aggregated disk usage of each one of the Lucene index files (only
applies if segment stats are requested)
:arg level: Return indices stats aggregated at index, node or
shard level Valid choices: indices, node, shards Default: node
:arg timeout: Explicit operation timeout
:arg types: A comma-separated list of document types for the
`indexing` index metric
"""
return await self.transport.perform_request(
"GET",
_make_path("_nodes", node_id, "stats", metric, index_metric),
params=params,
headers=headers,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params
class RemoteClient(NamespacedClient):
@query_params()
def info(self, params=None, headers=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html>`_
"""
return self.transport.perform_request(
"GET", "/_remote/info", params=params, headers=headers
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class RollupClient(NamespacedClient):
@query_params()
async def delete_job(self, id, params=None, headers=None):
"""
Deletes an existing rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-delete-job.html>`_
:arg id: The ID of the job to delete
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"DELETE", _make_path("_rollup", "job", id), params=params, headers=headers
)
@query_params()
async def get_jobs(self, id=None, params=None, headers=None):
"""
Retrieves the configuration, stats, and status of rollup jobs.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-get-job.html>`_
:arg id: The ID of the job(s) to fetch. Accepts glob patterns,
or left blank for all jobs
"""
return await self.transport.perform_request(
"GET", _make_path("_rollup", "job", id), params=params, headers=headers
)
@query_params()
async def get_rollup_caps(self, id=None, params=None, headers=None):
"""
Returns the capabilities of any rollup jobs that have been configured for a
specific index or index pattern.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-get-rollup-caps.html>`_
:arg id: The ID of the index to check rollup capabilities on, or
left blank for all jobs
"""
return await self.transport.perform_request(
"GET", _make_path("_rollup", "data", id), params=params, headers=headers
)
@query_params()
async def get_rollup_index_caps(self, index, params=None, headers=None):
"""
Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the
index where rollup data is stored).
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-get-rollup-index-caps.html>`_
:arg index: The rollup index or index pattern to obtain rollup
capabilities from.
"""
if index in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'index'.")
return await self.transport.perform_request(
"GET", _make_path(index, "_rollup", "data"), params=params, headers=headers
)
@query_params()
async def put_job(self, id, body, params=None, headers=None):
"""
Creates a rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-put-job.html>`_
:arg id: The ID of the job to create
:arg body: The job configuration
"""
for param in (id, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path("_rollup", "job", id),
params=params,
headers=headers,
body=body,
)
@query_params("rest_total_hits_as_int", "typed_keys")
async def rollup_search(
self, index, body, doc_type=None, params=None, headers=None
):
"""
Enables searching rolled-up data using the standard query DSL.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-search.html>`_
:arg index: The indices or index-pattern(s) (containing rollup
or regular data) that should be searched
:arg body: The search request body
:arg doc_type: The doc type inside the index
:arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response
:arg typed_keys: Specify whether aggregation and suggester names
should be prefixed by their respective types in the response
"""
for param in (index, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"POST",
_make_path(index, doc_type, "_rollup_search"),
params=params,
headers=headers,
body=body,
)
@query_params()
async def start_job(self, id, params=None, headers=None):
"""
Starts an existing, stopped rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-start-job.html>`_
:arg id: The ID of the job to start
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"POST",
_make_path("_rollup", "job", id, "_start"),
params=params,
headers=headers,
)
@query_params("timeout", "wait_for_completion")
async def stop_job(self, id, params=None, headers=None):
"""
Stops an existing, started rollup job.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rollup-stop-job.html>`_
:arg id: The ID of the job to stop
:arg timeout: Block for (at maximum) the specified duration
while waiting for the job to stop. Defaults to 30s.
:arg wait_for_completion: True if the API should block until the
job has fully stopped, false if should be executed async. Defaults to
false.
"""
if id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'id'.")
return await self.transport.perform_request(
"POST",
_make_path("_rollup", "job", id, "_stop"),
params=params,
headers=headers,
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path, SKIP_IN_PATH
class SearchableSnapshotsClient(NamespacedClient):
@query_params("allow_no_indices", "expand_wildcards", "ignore_unavailable")
async def clear_cache(self, index=None, params=None, headers=None):
"""
Clear the cache of searchable snapshots.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/searchable-snapshots-api-clear-cache.html>`_
:arg index: A comma-separated list of index name to limit the
operation
: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, "_searchable_snapshots", "cache", "clear"),
params=params,
headers=headers,
)
@query_params("master_timeout", "wait_for_completion")
async def mount(self, repository, snapshot, body, params=None, headers=None):
"""
Mount a snapshot as a searchable index.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/searchable-snapshots-api-mount-snapshot.html>`_
:arg repository: The name of the repository containing the
snapshot of the index to mount
:arg snapshot: The name of the snapshot of the index to mount
:arg body: The restore configuration for mounting the snapshot
as searchable
:arg master_timeout: Explicit operation timeout for connection
to master node
:arg wait_for_completion: Should this request wait until the
operation has completed before returning
"""
for param in (repository, snapshot, body):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"POST",
_make_path("_snapshot", repository, snapshot, "_mount"),
params=params,
headers=headers,
body=body,
)
@query_params()
async def repository_stats(self, repository, params=None, headers=None):
"""
Retrieve usage statistics about a snapshot repository.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/searchable-snapshots-repository-stats.html>`_
:arg repository: The repository for which to get the stats for
"""
if repository in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'repository'.")
return await self.transport.perform_request(
"GET",
_make_path("_snapshot", repository, "_stats"),
params=params,
headers=headers,
)
@query_params()
async def stats(self, index=None, params=None, headers=None):
"""
Retrieve various statistics about searchable snapshots.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/searchable-snapshots-api-stats.html>`_
:arg index: A comma-separated list of index names
"""
return await self.transport.perform_request(
"GET",
_make_path(index, "_searchable_snapshots", "stats"),
params=params,
headers=headers,
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, SKIP_IN_PATH
class SqlClient(NamespacedClient):
@query_params()
async def clear_cursor(self, body, params=None, headers=None):
"""
Clears the SQL cursor
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/sql-pagination.html>`_
:arg body: Specify the cursor value in the `cursor` element to
clean the cursor.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return await self.transport.perform_request(
"POST", "/_sql/close", params=params, headers=headers, body=body
)
@query_params("format")
async def query(self, body, params=None, headers=None):
"""
Executes a SQL request
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/sql-rest-overview.html>`_
:arg body: Use the `query` element to start a query. Use the
`cursor` element to continue a query.
:arg format: a short version of the Accept header, e.g. json,
yaml
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return await self.transport.perform_request(
"POST", "/_sql", params=params, headers=headers, body=body
)
@query_params()
async def translate(self, body, params=None, headers=None):
"""
Translates SQL into Elasticsearch queries
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/sql-translate.html>`_
:arg body: Specify the query in the `query` element.
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return await self.transport.perform_request(
"POST", "/_sql/translate", params=params, headers=headers, body=body
)
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params
class SslClient(NamespacedClient):
@query_params()
async def certificates(self, params=None, headers=None):
"""
Retrieves information about the X.509 certificates used to encrypt
communications in the cluster.
`<https://www.elastic.co/guide/en/elasticsearch/reference/7.8/security-api-ssl.html>`_
"""
return await self.transport.perform_request(
"GET", "/_ssl/certificates", params=params, headers=headers
)
This diff is collapsed.
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from ...client.utils import ( # noqa
_make_path,
_normalize_hosts,
_escape,
_bulk_body,
query_params,
SKIP_IN_PATH,
NamespacedClient,
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
from .utils import NamespacedClient, query_params, _make_path
class DeprecationClient(NamespacedClient):
@query_params()
def info(self, index=None, params=None, headers=None):
"""
`<http://www.elastic.co/guide/en/migration/7.x/migration-api-deprecation.html>`_
:arg index: Index pattern
"""
return self.transport.perform_request(
"GET",
_make_path(index, "_xpack", "migration", "deprecations"),
params=params,
headers=headers,
)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment