(clear-cache conn)(clear-cache conn index-name)(clear-cache conn index-name & args)
Clears index caches.

0-arity clears caches for *all* indexes and may be a very expensive operation. Use it carefully.
1-arity clears caches for a single index.

Accepted options:

:filter : should filter caches be cleared?
:field_data : should field data caches be cleared?
:bloom : should Bloom filter caches be cleared?

API Reference:


(close conn index-name)


(create conn index-name & args)
Creates an index.

Accepted options are :mappings and :settings. Both accept maps with the same structure as in the REST API.


 (require '[ :as idx])

 (idx/create conn "myapp_development")
 (idx/create conn "myapp_development" :settings {"number_of_shards" 1})

 (let [mapping-types {:person {:properties {:username   {:type "string" :store "yes"}
                                            :first-name {:type "string" :store "yes"}
                                            :last-name  {:type "string"}
                                            :age        {:type "integer"}
                                            :title      {:type "string" :analyzer "snowball"}
                                            :planet     {:type "string"}
                                            :biography  {:type "string" :analyzer "snowball" :term_vector "with_positions_offsets"}}}}]
   (idx/create conn "myapp_development" :mappings mapping-types))

Related ElasticSearch API Reference section:


(create-template conn template-name & args)
Creates or updates a new index template.

Accepted options:

:template : a pattern of index name that this template will be applied to
:settings : the same as for index/create
:mappings : the same as for index/create
:aliases  : template aliases configuration

API Reference:


(delete conn)(delete conn index-name)


(delete-mapping conn index-name type-name)
Allow to delete a mapping (type) along with its data.

API Reference:


(delete-template conn template-name)


(exists? conn index-name)
Used to check if the index (indices) exists or not.

API Reference:


(flush conn)(flush conn index-name)(flush conn index-name & args)
Flushes an index.

This causes the index by flushing data to the index storage and clearing the internal transaction log.
Typically it is sufficient to let ElasticSearch when to periodically flush indexes.

0-arity flushes *all* indexes and may be a very expensive operation. Use it carefully.
1-arity flushes a single index.

Accepted options:

:refresh : should a refresh be performed after the flush?

API Reference:


(get-aliases conn index-name)
Fetches and returns aliases for an index or multiple indexes.

API Reference:


(get-mapping conn index-name)(get-mapping conn index-name type-name)
The get mapping API allows to retrieve mapping definition of index or index/type.

API Reference:


(get-settings conn)(get-settings conn index-name)
The get settings API allows to retrieve settings of an index or multiple indices

API Reference:


(get-template conn template-name)


(open conn index-name)


(optimize conn)(optimize conn index-name & args)
Optimizes an index.

Optimization makes searches over the index faster and also reclaims some disk space used by
deleted documents. Optionally you can optimize and refresh an index in a single request.

0-arity optimizes *all* indexes and may be a very expensive operation. Use it carefully.
1-arity optimizes a single index.

Accepted options:

:max_num_segments : the number of segments to optimize to.
:only_expunge_deletes : should the optimize process only expunge segments with deleted documents in it?
:refresh : when set to true, refreshes the index
:flush : when set to true, flushes the index
:wait_for_merge : should the request wait for the merge to end?

API Reference:


(refresh conn)(refresh conn index-name)
Refreshes an index manually.

Refreshing an index makes all changes (added, modified and deleted documents) since the last refresh available for search. In other
words, index changes become "visible" to clients. ElasticSearch periodically refreshes indexes, the period is configurable via index

0-arity updates *all* indexes and may be a very expensive operation. Use it carefully.
1-arity refreshes a single index.

API Reference:


(segments conn)(segments conn index-name)
Returns segments information for an index or multiple indexes.

API Reference:


(snapshot conn index-name)
Takes a snapthot of an index or multiple indexes.

API Reference:


(stats conn index-name & args)
Returns statistics about an index or multiple indexes

Accepted options define what exactly will be contained in the response:

:stats : the specific stat(s) to return (defaults to all)

:types : combined with index stats to provide document type level stats
:groups : search statistics can be associated with one or more groups
:fields : fields to be included in the statistics by default where applicable
:completion_fields : fields to be included in the completion suggest statistics
:fielddata_fields : fields to be included in the fielddata statistics

API Reference:


(status conn index-name & args)
Returns recovery and/or snapshot status of an index.

Accepted options:

:recovery : should recovery status be returned?
:snapshot : should snapshot status be returned?

API Reference:


(type-exists? conn index-name type-name)
Used to check if a type/types exists in an index/indices.

API Reference:


(update-aliases conn & actions)
Performs a batch of alias operations. Takes a collection of actions in the form of

{ :add    { :index "test1" :alias "alias1" } }
{ :remove { :index "test1" :alias "alias1" } }

and so on, the same as described in the ElasticSearch documentation guide on aliases:


(update-mapping conn index-name-or-names type-name & args)
The put mapping API allows to register or modify specific mapping definition for a specific type.

API Reference:


(update-settings conn settings)(update-settings conn index-name settings)
Change specific index level settings in real time.

API Reference: