API Reference
High-level API to ElasticsearchClient. Each method receive ElasticsearchClient.Client and params as keyword arguments. Reponse similarto HTTP.Response, but it coverts body to String instead of CodeUnits or store body as Dict, if content type is application/json.
Example
using ElasticsearchClient
client = ElasticsearchClient.Client()
body = (
query=(
match_all=Dict(),
),
)
response = ElasticsearchClient.search(client, body=body)
@show response.body["took"]
ElasticsearchClient.API.Response
— TypeStore Elastic response with body, headers and status
function Response(http_response::HTTP.Response)
Create response structure and convert body to String if it's CodeUnits
ElasticsearchClient.API.search
— FunctionReturns results matching a query.
index::Union{String, Vector{String}}
: A comma-separated list of index names to search; use_all
or empty string to perform the operation on all indicesanalyzer::String
: The analyzer to use for the query stringanalyze_wildcard::Bool
: specify whether wildcard and prefix queries should be analyzed (default: false)ccs_minimize_roundtrips::Bool
: Indicates whether network round-trips should be minimized as part of cross-cluster search requests executiondefault_operator::String
: The default operator for query string query (AND or OR) (options: AND, OR)df::String
: The field to use as default where no field prefix is given in the query stringexplain::Bool
: Specify whether to return detailed information about score computation as part of a hitstored_fields::{String, Vector{String}}
: A comma-separated list of stored fields to return as part of a hitdocvalue_fields::{String, Vector{String}}
A comma-separated list of fields to return as the docvalue representation of a field for each hitfrom::Integer
: Starting offset (default: 0)force_synthetic_source::Bool
: Should this request force synthetic _source? Use this to test if the mapping supports synthetic _source and to get a sense of the worst case performance. Fetches with this enabled will be slower the enabling synthetic source natively in the index.ignore_unavailable::Bool
: Whether specified concrete indices should be ignored when unavailable (missing or closed)ignore_throttled::Bool
: Whether specified concrete, expanded or aliased indices should be ignored when throttledallow_no_indices::Bool
: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes_all
string or when no indices have been specified)expand_wildcards::String
: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)lenient::Bool
: Specify whether format-based query failures (such as providing text to a numeric field) should be ignoredpreference::String
: Specify the node or shard the operation should be performed on (default: random)q::String
: Query in the Lucene query string syntaxrouting::Union{String, Vector{String}}
: A comma-separated list of specific routing valuesscroll::DateTime
: Specify how long a consistent view of the index should be maintained for scrolled searchsearch_type::String
: Search operation type (options: querythenfetch, dfsquerythen_fetch)size::Integer
: Number of hits to return (default: 10)sort::Union{String, Vector{String}}
: A comma-separated list of <field>:<direction> pairs_source::Union{String, Vector{String}}
: True or false to return the _source field or not, or a list of fields to return_source_excludes::Union{String, Vector{String}}
: A list of fields to exclude from the returned _source field_source_includes::Union{String, Vector{String}}
: A list of fields to extract and return from the _source fieldterminate_after::Integer
: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.stats::Union{String, Vector{String}}
: Specific 'tag' of the request for logging and statistical purposessuggest_field::String
: Specify which field to use for suggestionssuggest_mode::String
: Specify suggest mode (options: missing, popular, always)suggest_size::Integer
: How many suggestions to return in responsesuggest_text::String
: The source text for which the suggestions should be returnedtimeout::DateTime
: Explicit operation timeouttrack_scores::Bool
: Whether to calculate and return scores even if they are not used for sorting- `[Boolean|long] :tracktotalhits Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
allow_partial_search_results::Bool
: Indicate if an error should be returned if there is a partial search failure or timeouttyped_keys::Bool
: Specify whether aggregation and suggester names should be prefixed by their respective types in the responseversion::Bool
: Specify whether to return document version as part of a hitseq_no_primary_term::Bool
: Specify whether to return sequence number and primary term of the last modification of each hitrequest_cache::Bool
: Specify if request cache should be used for this request or not, defaults to index level settingbatched_reduce_size::Integer
: The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.max_concurrent_shard_requests::Integer
: 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 requestspre_filter_shard_size::Integer
: A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint.rest_total_hits_as_int::Bool
: Indicates whether hits.total should be rendered as an integer or an object in the rest search responsemin_compatible_shard_node::String
: The minimum compatible version that all shards involved in search should have for this request to be successfulheaders::Dict
: Custom HTTP headersbody::Union{Dict,NamedTuple}
: The search definition using the Query DSL
See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
ElasticsearchClient.API.search_template
— FunctionAllows to use the Mustache language to pre-render a search definition.
index::Union{String,Vector{String}}
: A comma-separated list of index names to search; use_all
or empty string to perform the operation on all indicesignore_unavailable::Bool
: Whether specified concrete indices should be ignored when unavailable (missing or closed)ignore_throttled::Bool
: Whether specified concrete, expanded or aliased indices should be ignored when throttledallow_no_indices::Bool
: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes_all
string or when no indices have been specified)expand_wildcards::String
: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)preference::String
: Specify the node or shard the operation should be performed on (default: random)routing::Union{String,Vector{String}}
: A comma-separated list of specific routing valuesscroll::DateTime
: Specify how long a consistent view of the index should be maintained for scrolled searchsearch_type::String
: Search operation type (options: querythenfetch, dfsquerythen_fetch)explain::Bool
: Specify whether to return detailed information about score computation as part of a hitprofile::Bool
: Specify whether to profile the query executiontyped_keys::Bool
: Specify whether aggregation and suggester names should be prefixed by their respective types in the responserest_total_hits_as_int::Bool
: Indicates whether hits.total should be rendered as an integer or an object in the rest search responseccs_minimize_roundtrips::Bool
: Indicates whether network round-trips should be minimized as part of cross-cluster search requests executionheaders::Dict
: Custom HTTP headersbody::Union{Dict,NamedTuple}
: The search definition template and its params (Required)
See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html
ElasticsearchClient.API.put_script
— FunctionCreates or updates a script.
id::String
: Script IDcontext::String
: Script contexttimeout::DateTime
: Explicit operation timeoutmaster_timeout::DateTime
: Specify timeout for connection to masterheaders::Dict
: Custom HTTP headersbody::Union{Dict,NamedTuple}
: The document (Required)
See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html
ElasticsearchClient.API.index
— FunctionCreates or updates a document in an index.
id::String
: Document IDindex::String
: The name of the indexwait_for_active_shards::String
: Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set toall
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)op_type::String
: Explicit operation type. Defaults toindex
for requests with an explicit document ID, and tocreate
for requests without an explicit document ID (options: index, create)refresh::String
: Iftrue
then refresh the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
(the default) then do nothing with refreshes. (options: true, false, wait_for)routing::String
: Specific routing valuetimeout::DateTime
: Explicit operation timeoutversion::Integer
: Explicit version number for concurrency controlversion_type::String
: Specific version type (options: internal, external, external_gte)if_seq_no::Integer
: only perform the index operation if the last operation that has changed the document has the specified sequence numberif_primary_term::Integer
: only perform the index operation if the last operation that has changed the document has the specified primary termpipeline::String
: The pipeline id to preprocess incoming documents withrequire_alias::Bool
: When true, requires destination to be an alias. Default is falseheaders::Dict
: Custom HTTP headersbody::Union{NamedTuple,Dict}
: The document (Required)
See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
ElasticsearchClient.API.bulk
— FunctionAllows to perform multiple index/update/delete operations in a single request.
index::String
: Default index for items which don't provide onewait_for_active_shards::String
: Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set toall
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)refresh::String
: Iftrue
then refresh the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
(the default) then do nothing with refreshes. (options: true, false, wait_for)routing::String
: Specific routing valuetimeout::DateTime
: Explicit operation timeouttype::String
: Default document type for items which don't provide one_source::Union{Vector{String}, String}
: True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request_source_excludes::Union{Vector{String}, String}
: Default list of fields to exclude from the returned _source field, can be overridden on each sub-request_source_includes::Union{Vector{String}, String}
: Default list of fields to extract and return from the _source field, can be overridden on each sub-requestpipeline::String
: The pipeline id to preprocess incoming documents withrequire_alias::Bool
: Sets require_alias for all incoming documents. Defaults to unset (false)headers::Bool
: Custom HTTP headersbody::Union{String,Vector}
: The operation definition and data (action-data pairs), separated by newlines. Array of String or Dicts or NamedTuples
See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
ElasticsearchClient.API.delete
— FunctionRemoves a document from the index.
id::String
: The document IDindex::String
: The name of the indexwait_for_active_shards::String
: Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set toall
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)refresh::String
: Iftrue
then refresh the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
(the default) then do nothing with refreshes. (options: true, false, wait_for)routing::String
: Specific routing valuetimeout::DateTime
: Explicit operation timeoutif_seq_no::Integer
: only perform the delete operation if the last operation that has changed the document has the specified sequence numberif_primary_term::Integer
: only perform the delete operation if the last operation that has changed the document has the specified primary termversion::Integer
: Explicit version number for concurrency controlversion_type::String
: Specific version type (options: internal, external, external_gte)headers::Dict
: Custom HTTP headers
See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
ElasticsearchClient.API.delete_by_query
— FunctionDeletes documents matching the provided query.
index::Union{String, Vector{String}}
: A comma-separated list of index names to search; use_all
or empty string to perform the operation on all indicesanalyzer::String
: The analyzer to use for the query stringanalyze_wildcard::Bool
: Specify whether wildcard and prefix queries should be analyzed (default: false)default_operator::String
: The default operator for query string query (AND or OR) (options: AND, OR)df::String
: The field to use as default where no field prefix is given in the query stringfrom::Integer
: Starting offset (default: 0)ignore_unavailable::Bool
: Whether specified concrete indices should be ignored when unavailable (missing or closed)allow_no_indices::Bool
: Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes_all
string or when no indices have been specified)conflicts::String
: What to do when the delete by query hits version conflicts? (options: abort, proceed)expand_wildcards::String
: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)lenient::Bool
: Specify whether format-based query failures (such as providing text to a numeric field) should be ignoredpreference::String
: Specify the node or shard the operation should be performed on (default: random)q::String
: Query in the Lucene query string syntaxrouting::Union{String, Vector{String}}
: A comma-separated list of specific routing valuesscroll::DateTime
: Specify how long a consistent view of the index should be maintained for scrolled searchsearch_type::String
: Search operation type (options: querythenfetch, dfsquerythen_fetch)search_timeout::DateTime
: Explicit timeout for each search request. Defaults to no timeout.max_docs::Integer
: Maximum number of documents to process (default: all documents)sort::Union{String, Vector{String}}
: A comma-separated list of <field>:<direction> pairsterminate_after::Integer
: The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.stats::Union{String, Vector{String}}
: Specific 'tag' of the request for logging and statistical purposesversion::Bool
: Specify whether to return document version as part of a hitrequest_cache::Bool
: Specify if request cache should be used for this request or not, defaults to index level settingrefresh::Bool
: Should the affected indexes be refreshed?timeout::DateTime
: Time each individual bulk request should wait for shards that are unavailable.wait_for_active_shards::String
: Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set toall
for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)scroll_size::Integer
: Size on the scroll request powering the delete by querywait_for_completion::Bool
: Should the request should block until the delete by query is complete.requests_per_second::Integer
: The throttle for this request in sub-requests per second. -1 means no throttle.slices::Union{Dict,String}
: The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set toauto
.headers::Dict
: Custom HTTP headersbody::Dict
: The search definition using the Query DSL (Required)
See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html