exlasticsearch v1.2.0 ExlasticSearch.Repo View Source

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"

Link to this section Summary

Functions

Generates an Elasticsearch bulk request. operations should be of the form

Close an index for model

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

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

Refreshes model’s index

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 index for model

Link to this section Types

Link to this type response() View Source
response() ::
  {:ok,
   %HTTPoison.Response{
     body: term(),
     headers: term(),
     request_url: term(),
     status_code: term()
   }}
  | {:error, any()}

Link to this section Functions

Link to this function bulk(operations, opts \\ []) View Source

Generates an Elasticsearch bulk request. operations should be of the form:

[
  {:index, struct}, 
  {:delete, other_struct}, 
  {:update, third_struct}
]

The function will handle formatting the bulk request properly and passing each struct to the ExlasticSearch.Indexable protocol

Close an index for model

Link to this function create_index(model) View Source
create_index(atom()) :: response()

Creates an index as defined in model

Link to this function create_mapping(model) View Source
create_mapping(atom()) :: response()

Updates an index’s mappings to the current definition in model

Removes struct from the index of its model

Link to this function delete_index(model) View Source
delete_index(atom()) :: response()

Removes the index defined in model

Link to this function exists?(model) View Source
exists?(atom()) :: boolean()

Checks if the index for model exists

Gets an ES document by _id

Adds a struct into it’s associated index. The struct will be passed through the ExlasticSearch.Indexable protocol prior to insertion

Link to this function index_stream(stream, parallelism \\ 10, demand \\ 10) View Source

open an index for model

Link to this function paginate(pageable, options \\ []) View Source
paginate(any(), map() | Keyword.t()) :: Scrivener.Page.t()

Refreshes model’s index

Creates a call to search/3 by realizing query (using Exlasticsearch.Query.realize/1) and any provided search opts

Link to this function search(model, search, params) View Source
search(atom(), map(), list()) :: response()

Searches the index and type associated with model according to query search

Updates the index for model