clojurewerkz.elastisch.native.index

clear-cache

(clear-cache conn index-name & args)
Clears caches index or multiple indices

close

(close conn index-name)
Closes an index or indices
Usage:
  (idx/close conn "my-index")
  (idx/close conn ["my-index" "dein-index"])

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.native.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)

delete

(delete conn)(delete conn index-name)
Deletes an existing index

delete-mapping

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

delete-template

(delete-template conn template-name)

exists?

(exists? conn index-name)
Returns true if given index (or indices) exists

flush

(flush conn index-name & args)
Flushes an index or multiple indices

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 index-name)
Gets index settings.

open

(open conn index-name)
Opens an index

optimize

(optimize conn index-name & args)
Optimizes an index or multiple indices

put-template

(put-template conn template-name & args)

refresh

(refresh conn index-name)
Refreshes an index or multiple indices

segments

(segments conn index-name)
Returns segments information for one or more indices.

stats

(stats conn)(stats conn & args)
Returns statistics about indexes.

No argument version returns all stats.
Options may be used to define what exactly will be contained in the response:

:docs : the number of documents, deleted documents
:store : the size of the index
:indexing : indexing statistics
:types : document type level stats
:groups : search group stats to retrieve the stats for
:get : get operation statistics, including missing stats
:search : search statistics, including custom grouping using the groups parameter (search operations can be associated with one or more groups)
:merge : merge operation stats
:flush : flush operation stats
:refresh : refresh operation stats

status

(status conn index-name & args)
Returns status for one or more indices.

Options may be used to define what exactly will be contained in the response:

:recovery (boolean, default: false): should the status include recovery information?
:snapshot (boolean, default: false): should the status include snapshot information?

type-exists?

(type-exists? conn index-name type-name)
Returns true if a type/types exists in an index/indices

update-aliases

(update-aliases conn ops & args)
Performs a batch of alias operations. Takes a collection of actions in the following form where
 plural keys (indices, aliases) can be supplied as collections or single strings

[{:add    { :indices "test1" :alias "alias1" }}
 {:remove { :index "test1" :aliases "alias1" }}]

update-mapping

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

update-settings

(update-settings conn index-name settings)
Updates index settings. No argument version updates index settings globally