clojurewerkz.elastisch.rest.index

clear-cache

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-clearcache.html

close

(close conn index-name)

create

(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.

Examples:

 (require '[clojurewerkz.elastisch.rest.index :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:
http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index.html

create-template

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-templates.html

delete

(delete conn)(delete conn index-name)

delete-mapping

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-mapping.html

delete-template

(delete-template conn template-name)

exists?

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-indices-exists.html

flush

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-flush.html

get-aliases

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html

get-mapping

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping.html

get-settings

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings.html

get-template

(get-template conn template-name)

open

(open conn index-name)

optimize

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-optimize.html

refresh

(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
settings.

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh.html

segments

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-segments.html

snapshot

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot.html

stats

(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: https://www.elastic.co/guide/en/elasticsearch/reference/1.5/indices-stats.html

status

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-status.html

type-exists?

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

API Reference: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-types-exists.html

update-aliases

(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:
http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html

update-mapping

(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: http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html

update-settings

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

API Reference: http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html