View Source ExlasticSearch.Repo (exlasticsearch v2.3.0)
API executor for elasticsearch.
The generate pattern is to define a ExlasticSearch.Model
on an Ecto model, then call any of these functions to manage the model.
To configure the URL the repo points to, do:
config :exlasticsearch, ExlasticSearch.Repo,
url: "https://elasticsearch.url.io:9200"
Summary
Functions
Performs an aggregation against a query, and returns only the aggregation results.
Generates an Elasticsearch bulk request. operations
should be of the form
Close an index for model
.
Aliases one index version to another, for instance
Creates an index as defined in model
.
Updates an index's mappings to the current definition in model
.
Removes struct
from the index of its model.
Removes the index defined in model
.
Checks if the index for model
exists.
Gets an ES document by _id
.
Retries the aliases for a given index.
Adds a struct into it's associated index.
Open an index for model
.
Refreshes model
's index.
Deletes the read index and aliases the write index to it.
Creates a call to search/3
by realizing query
(using Exlasticsearch.Query.realize/1
) and any provided search opts.
Searches the index and type associated with model
according to query search
.
Updates the document of the passed in id for the index associated to the model.
Updates all document based on the query using the provided script.
Updates the index for model
.
Types
Functions
Performs an aggregation against a query, and returns only the aggregation results.
Generates an Elasticsearch bulk request. operations
should be of the form:
[
{:index, struct, index},
{:delete, other_struct, index},
{:update, third_struct, id, map, index}
]
Note: the last element in each Tuple is optional and will default to :index
.
The function will handle formatting the bulk request properly and passing each
struct to the ExlasticSearch.Indexable
protocol.
Close an index for model
.
Aliases one index version to another, for instance:
alias(MyModel, read: :index)
Will create an alias of the read version of the model's index against it's indexing version.
Creates an index as defined in model
.
Updates an index's mappings to the current definition in model
.
Removes struct
from the index of its model.
Removes the index defined in model
.
Checks if the index for model
exists.
Gets an ES document by _id
.
Retries the aliases for a given index.
Adds a struct into it's associated index.
The struct will be passed through the ExlasticSearch.Indexable
protocol prior to insertion.
Open an index for model
.
@spec paginate(any(), map() | Keyword.t()) :: Scrivener.Page.t()
Refreshes model
's index.
Deletes the read index and aliases the write index to it.
@spec scrivener_defaults() :: Keyword.t()
@spec search(ExlasticSearch.Query.t(), list()) :: {:ok, %ExlasticSearch.Response.Search{hits: term(), total: term()}} | {:error, any()}
Creates a call to search/3
by realizing query
(using Exlasticsearch.Query.realize/1
) and any provided search opts.
@spec search(atom(), map(), list(), any()) :: {:ok, %ExlasticSearch.Response.Search{hits: term(), total: term()}} | {:error, any()}
Searches the index and type associated with model
according to query search
.
Updates the document of the passed in id for the index associated to the model.
Updates all document based on the query using the provided script.
Updates the index for model
.