ElasticsearchClient.ElasticTransport.ClientType

ElasticSearch client. Handling hosts configuration, verify elasticsearch and delegate requests to Transport

function Client(;http_client::Module, kwargs...)

Create a client connected to an Elastic cluster.

Possible arguments

  • http_client::Module: A module that implement request method. Maybe useful if you need custom http layers. HTTP.jl used bu default.
  • hosts: Single host passed as a String, Dict or NamedTuple, or multiple hosts passed as an Array; host, url, urls keys are also valid
  • serializer: Function to serialise the body to JSON. JSON.json by default
  • deserializer: Function to deserialise response body to Dict. JSON.parse by default
  • resurrect_after::Integer: After how many seconds a dead connection should be tried again
  • reload_connection::Bool: Reload connections after X requests (false by default)
  • randomize_hosts::Bool: Shuffle connections on initialization and reload (false by default)
  • sniffer_timeout::Integer: Timeout for reloading connections in seconds (1 by default)
  • retry_on_failure::Bool: Retry X times when request fails before raising and exception (false by default)
  • delay_on_retry::Integer: Delay in milliseconds between each retry (0 by default)
  • retry_on_status::Vector{Integer}: Retry when specific status codes are returned
  • reload_on_failure::Bool: Reload connections after failure (false by default)
  • request_timeout::Integer: The request timeout to be passed to transport in options
  • transport_options: Options to be passed to Connection. Now work only headers option
  • selector::Connections.AbstractSelector A struct type of selector strategy.
  • send_get_body_as: Specify the HTTP method to use for GET requests with a body. (Default: GET)
  • compression Whether to compress requests. Gzip compression will be used. The default is false. Responses will automatically be inflated if they are compressed.
ElasticsearchClient.ElasticTransport.perform_requestMethod

Low-level request to Elastic cluster.

Arguments

  • client::ElasticTransport.Client
  • method::String
  • path::String: elastic endpoint. Must start with /

Keyword arguments

  • params::Dict: Query params
  • body::Union{Nothing, Dict}: HTTP body, default Nothing
  • headers::Union{Nothing, Dict}: HTTP headers. They are merged with default headers. Default Nothing
ElasticsearchClient.API.Indices.createMethod

Creates an index with optional settings and mappings.

  • index::String: The name of the index
  • wait_for_active_shards::String: Set the number of active shards to wait for before the operation returns.
  • timeout::DateTime: Explicit operation timeout
  • master_timeout::DateTime: Specify timeout for connection to master
  • headers::Dict: Custom HTTP headers
  • body::Union{NamedTuple,Dict}: The configuration for the index (settings and mappings)

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

ElasticsearchClient.API.Indices.deleteMethod

Deletes an index.

  • index::Union{String,Vector{String}}: A comma-separated list of indices to delete; use _all or * string to delete all indices
  • timeout::DateTime: Explicit operation timeout
  • master_timeout::DateTime: Specify timeout for connection to master
  • ignore_unavailable::Bool: Ignore unavailable indexes (default: false)
  • allow_no_indices::Bool: Ignore if a wildcard expression resolves to no concrete indices (default: false)
  • expand_wildcards::String: Whether wildcard expressions should get expanded to open, closed, or hidden indices (options: open, closed, hidden, none, all)
  • headers::Dict: Custom HTTP headers

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html

ElasticsearchClient.API.Indices.existsMethod

Returns information about whether a particular index exists.

  • index::Union{String,Vector{String}}: A comma-separated list of index names
  • local::Bool: Return local information, do not retrieve the state from master node (default: false)
  • ignore_unavailable::Bool: Ignore unavailable indexes (default: false)
  • allow_no_indices::Bool: Ignore if a wildcard expression resolves to no concrete indices (default: false)
  • expand_wildcards::String: Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)
  • flat_settings::Bool: Return settings in flat format (default: false)
  • include_defaults::Bool: Whether to return all default setting for each of the indices.
  • headers::Dict: Custom HTTP headers

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html

ElasticsearchClient.API.Indices.exists_aliasMethod

Returns information about whether a particular alias exists.

  • name::Union{String,Vector{String}}: A comma-separated list of alias names to return
  • index::Union{String,Vector{String}}: A comma-separated list of index names to filter aliases
  • 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)
  • expand_wildcards::String: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
  • local::Bool: Return local information, do not retrieve the state from master node (default: false)
  • headers::Dict: Custom HTTP headers

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

ElasticsearchClient.API.Indices.getMethod

Returns information about one or more indices.

  • index::Union(String,Vector{String}}: A comma-separated list of index names
  • local::Bool: Return local information, do not retrieve the state from master node (default: false)
  • ignore_unavailable::Bool: Ignore unavailable indexes (default: false)
  • allow_no_indices::Bool: Ignore if a wildcard expression resolves to no concrete indices (default: false)
  • expand_wildcards::String: Whether wildcard expressions should get expanded to open or closed indices (default: open) (options: open, closed, hidden, none, all)
  • features::String: Return only information on specified index features (options: aliases, mappings, settings)
  • flat_settings::Bool: Return settings in flat format (default: false)
  • include_defaults::Bool: Whether to return all default setting for each of the indices.
  • master_timeout::DateTime: Specify timeout for connection to master
  • headers::Dict: Custom HTTP headers

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html

ElasticsearchClient.API.Indices.put_aliasMethod

Creates or updates an alias.

  • index::Union{String,Vector{String}}: A comma-separated list of index names the alias should point to (supports wildcards); use _all to perform the operation on all indices.
  • name::String: The name of the alias to be created or updated
  • timeout::DateTime: Explicit timestamp for the document
  • master_timeout::DateTime: Specify timeout for connection to master
  • headers::Dict: Custom HTTP headers
  • body::Union{NamedTuple,Dict}: The settings for the alias, such as routing or filter

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

ElasticsearchClient.API.Indices.refreshMethod

Performs the refresh operation in one or more indices.

  • index::Union{String,Vector{String}}: A comma-separated list of index names; use _all or empty string to perform the operation on all indices
  • 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)
  • expand_wildcards::String: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
  • headers::Dict: Custom HTTP headers

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html

ElasticsearchClient.API.Indices.update_aliasesMethod

Updates index aliases.

  • timeout::DateTime: Request timeout
  • master_timeout::DateTime: Specify timeout for connection to master
  • headers::Dict: Custom HTTP headers
  • body::Union{NamedTuple,Dict}: The definition of actions to perform (Required)

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html

ElasticsearchClient.API.Cat.indicesMethod

Returns information about indices: number of primaries and replicas, document counts, disk size, ...

  • index::Union{String,Vector{String}}: A comma-separated list of index names to limit the returned information
  • format::String: a short version of the Accept header, e.g. json, yaml
  • bytes::String: The unit in which to display byte values (options: b, k, kb, m, mb, g, gb, t, tb, p, pb)
  • master_timeout::DateTime: Explicit operation timeout for connection to master node
  • h::Union{String,Vector{String}}: Comma-separated list of column names to display
  • health::String: A health status ("green", "yellow", or "red" to filter only indices matching the specified health status (options: green, yellow, red)
  • help::Bool: Return help information
  • pri::Bool: Set to true to return stats only for primary shards
  • s::Union{String,Vector{String}}: Comma-separated list of column names or column aliases to sort by
  • time::String: The unit in which to display time values (options: d, h, m, s, ms, micros, nanos)
  • v::Bool: Verbose mode. Display column headers
  • include_unloaded_segments::Bool: If set to true segment stats will include stats for segments that are not currently loaded into memory
  • expand_wildcards::String: Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
  • headers::Dict: Custom HTTP headers

See https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html

ElasticsearchClient.API.ResponseType

Store 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.bulkMethod

Allows to perform multiple index/update/delete operations in a single request.

  • index::String: Default index for items which don't provide one
  • wait_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 to all 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: If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. (options: true, false, wait_for)
  • routing::String: Specific routing value
  • timeout::DateTime: Explicit operation timeout
  • type::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-request
  • pipeline::String: The pipeline id to preprocess incoming documents with
  • require_alias::Bool: Sets require_alias for all incoming documents. Defaults to unset (false)
  • headers::Bool: Custom HTTP headers
  • body::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.deleteMethod

Removes a document from the index.

  • id::String: The document ID
  • index::String: The name of the index
  • wait_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 to all 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: If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. (options: true, false, wait_for)
  • routing::String: Specific routing value
  • timeout::DateTime: Explicit operation timeout
  • if_seq_no::Integer: only perform the delete operation if the last operation that has changed the document has the specified sequence number
  • if_primary_term::Integer: only perform the delete operation if the last operation that has changed the document has the specified primary term
  • version::Integer: Explicit version number for concurrency control
  • version_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_queryMethod

Deletes 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 indices
  • analyzer::String: The analyzer to use for the query string
  • analyze_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 string
  • from::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 ignored
  • preference::String: Specify the node or shard the operation should be performed on (default: random)
  • q::String: Query in the Lucene query string syntax
  • routing::Union{String, Vector{String}}: A comma-separated list of specific routing values
  • scroll::DateTime: Specify how long a consistent view of the index should be maintained for scrolled search
  • search_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> pairs
  • terminate_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 purposes
  • version::Bool: Specify whether to return document version as part of a hit
  • request_cache::Bool: Specify if request cache should be used for this request or not, defaults to index level setting
  • refresh::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 to all 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 query
  • wait_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 to auto.
  • headers::Dict: Custom HTTP headers
  • body::Dict: The search definition using the Query DSL (Required)

See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

ElasticsearchClient.API.indexMethod

Creates or updates a document in an index.

  • id::String: Document ID
  • index::String: The name of the index
  • wait_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 to all 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 to index for requests with an explicit document ID, and to createfor requests without an explicit document ID (options: index, create)
  • refresh::String: If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes. (options: true, false, wait_for)
  • routing::String: Specific routing value
  • timeout::DateTime: Explicit operation timeout
  • version::Integer: Explicit version number for concurrency control
  • version_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 number
  • if_primary_term::Integer: only perform the index operation if the last operation that has changed the document has the specified primary term
  • pipeline::String: The pipeline id to preprocess incoming documents with
  • require_alias::Bool: When true, requires destination to be an alias. Default is false
  • headers::Dict: Custom HTTP headers
  • body::Union{NamedTuple,Dict}: The document (Required)

See https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

ElasticsearchClient.API.put_scriptMethod

Creates or updates a script.

  • id::String: Script ID
  • context::String: Script context
  • timeout::DateTime: Explicit operation timeout
  • master_timeout::DateTime: Specify timeout for connection to master
  • headers::Dict: Custom HTTP headers
  • body::Union{Dict,NamedTuple}: The document (Required)

See https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

ElasticsearchClient.API.searchMethod

Returns 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 indices
  • analyzer::String: The analyzer to use for the query string
  • analyze_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 execution
  • 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 string
  • explain::Bool: Specify whether to return detailed information about score computation as part of a hit
  • stored_fields::{String, Vector{String}}: A comma-separated list of stored fields to return as part of a hit
  • docvalue_fields::{String, Vector{String}} A comma-separated list of fields to return as the docvalue representation of a field for each hit
  • from::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 throttled
  • 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)
  • 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 ignored
  • preference::String: Specify the node or shard the operation should be performed on (default: random)
  • q::String: Query in the Lucene query string syntax
  • routing::Union{String, Vector{String}}: A comma-separated list of specific routing values
  • scroll::DateTime: Specify how long a consistent view of the index should be maintained for scrolled search
  • search_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 field
  • terminate_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 purposes
  • suggest_field::String: Specify which field to use for suggestions
  • suggest_mode::String: Specify suggest mode (options: missing, popular, always)
  • suggest_size::Integer: How many suggestions to return in response
  • suggest_text::String: The source text for which the suggestions should be returned
  • timeout::DateTime: Explicit operation timeout
  • track_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 timeout
  • typed_keys::Bool: Specify whether aggregation and suggester names should be prefixed by their respective types in the response
  • version::Bool: Specify whether to return document version as part of a hit
  • seq_no_primary_term::Bool: Specify whether to return sequence number and primary term of the last modification of each hit
  • request_cache::Bool: Specify if request cache should be used for this request or not, defaults to index level setting
  • batched_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 requests
  • pre_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 response
  • min_compatible_shard_node::String: The minimum compatible version that all shards involved in search should have for this request to be successful
  • headers::Dict: Custom HTTP headers
  • body::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_templateMethod

Allows 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 indices
  • 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 throttled
  • 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)
  • 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 values
  • scroll::DateTime: Specify how long a consistent view of the index should be maintained for scrolled search
  • search_type::String: Search operation type (options: querythenfetch, dfsquerythen_fetch)
  • explain::Bool: Specify whether to return detailed information about score computation as part of a hit
  • profile::Bool: Specify whether to profile the query execution
  • typed_keys::Bool: Specify whether aggregation and suggester names should be prefixed by their respective types in the response
  • rest_total_hits_as_int::Bool: Indicates whether hits.total should be rendered as an integer or an object in the rest search response
  • ccs_minimize_roundtrips::Bool: Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution
  • headers::Dict: Custom HTTP headers
  • body::Union{Dict,NamedTuple}: The search definition template and its params (Required)

See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html