(async-create conn index mapping-type document)
(async-create conn index mapping-type document opts)
Adds document to the search index and returns a future without waiting
for the response. Takes exactly the same arguments as create
.
Adds document to the search index and returns a future without waiting for the response. Takes exactly the same arguments as [[create]].
(async-get conn index mapping-type id)
(async-get conn index mapping-type id opts)
Fetches and returns a document by id or nil
if it does not exist.
Returns a future without waiting.
Fetches and returns a document by id or `nil` if it does not exist. Returns a future without waiting.
(async-put conn index mapping-type id document)
(async-put conn index mapping-type id document opts)
Creates or updates a document in the search index using the provided document id
and returns a future without waiting for the response. Takes exactly the same arguments as put
.
Creates or updates a document in the search index using the provided document id and returns a future without waiting for the response. Takes exactly the same arguments as [[put]].
(count conn index mapping-type)
(count conn index mapping-type query)
(count conn index mapping-type query opts)
Performs a count query.
Examples:
(require '[clojurewerkz.elastisch.native.document :as doc])
(require '[clojurewerkz.elastisch.query :as q])
(doc/count conn "people" "person")
(doc/count conn "people" "person" (q/prefix {:username "appl"}))
Performs a count query. Examples: ```clojure (require '[clojurewerkz.elastisch.native.document :as doc]) (require '[clojurewerkz.elastisch.query :as q]) (doc/count conn "people" "person") (doc/count conn "people" "person" (q/prefix {:username "appl"})) ```
(create conn index mapping-type document)
(create conn index mapping-type document opts)
Adds document to the search index and waits for the response. If not given as an option, document id will be generated automatically.
Options:
:id
(string): unique document id. If not provided, it will be generated by Elasticsearch:timestamp
(string): document timestamp either as millis since the epoch,
or, in the configured date format:ttl
(long): document TTL in milliseconds. Must be > 0:refresh
(boolean, default: false
): should a refresh be executed post this index operation?:version
(long): document version:version-type
(string, default: "internal"
): "internal"
or "external"
:content-type
(string): document content type:routing
(string): controls the shard routing of the request. Using this value to hash the shard
and not the id:percolate
(string): the percolate query to use to reduce the percolated queries that are going to run against this doc.
Can be set to "*"
which means "all queries":parent
(string): parent document idExamples:
(require '[clojurewerkz.elastisch.native.document :as doc])
(doc/create conn "people" "person" {:first-name "John" :last-name "Appleseed" :age 28})
(doc/create conn "people" "person" {:first-name "John" :last-name "Appleseed" :age 28} {:id "1825c5432775b8d1a477acfae57e91ac8c767aed"})
Adds document to the search index and waits for the response. If not given as an option, document id will be generated automatically. Options: * `:id` (string): unique document id. If not provided, it will be generated by Elasticsearch * `:timestamp` (string): document timestamp either as millis since the epoch, or, in the configured date format * `:ttl` (long): document TTL in milliseconds. Must be > 0 * `:refresh` (boolean, default: `false`): should a refresh be executed post this index operation? * `:version` (long): document version * `:version-type` (string, default: `"internal"`): `"internal"` or `"external"` * `:content-type` (string): document content type * `:routing` (string): controls the shard routing of the request. Using this value to hash the shard and not the id * `:percolate` (string): the percolate query to use to reduce the percolated queries that are going to run against this doc. Can be set to `"*"` which means "all queries" * `:parent` (string): parent document id Examples: ```clojure (require '[clojurewerkz.elastisch.native.document :as doc]) (doc/create conn "people" "person" {:first-name "John" :last-name "Appleseed" :age 28}) (doc/create conn "people" "person" {:first-name "John" :last-name "Appleseed" :age 28} {:id "1825c5432775b8d1a477acfae57e91ac8c767aed"}) ```
(create-search-template conn id document)
(create-search-template conn language id document)
Adds a search template to the .scripts index the template should be
a map of the form:
{:template {:filter {:term {:name "{{name}}"}}}}
templates can be referenced at search time using their given id
Adds a search template to the .scripts index the template should be a map of the form: `{:template {:filter {:term {:name "{{name}}"}}}}` templates can be referenced at search time using their given id
(delete conn index mapping-type id)
(delete conn index mapping-type id opts)
Deletes document from the index.
Examples:
(require '[clojurewerkz.elastisch.native.document :as doc])
(doc/delete conn "people" "person" "1825c5432775b8d1a477acfae57e91ac8c767aed")
Deletes document from the index. Examples: ```clojure (require '[clojurewerkz.elastisch.native.document :as doc]) (doc/delete conn "people" "person" "1825c5432775b8d1a477acfae57e91ac8c767aed") ```
(delete-search-template conn id)
(delete-search-template conn language id)
Removes a search template from .scripts index
Removes a search template from .scripts index
(get conn index mapping-type id)
(get conn index mapping-type id opts)
Fetches and returns a document by id or nil
if it does not exist.
Waits for response.
Examples:
(require '[clojurewerkz.elastisch.native.document :as doc])
(doc/get conn "people" "person" "1825c5432775b8d1a477acfae57e91ac8c767aed")
Fetches and returns a document by id or `nil` if it does not exist. Waits for response. Examples: ```clojure (require '[clojurewerkz.elastisch.native.document :as doc]) (doc/get conn "people" "person" "1825c5432775b8d1a477acfae57e91ac8c767aed") ```
(multi-get conn queries)
(multi-get conn index queries)
(multi-get conn index mapping-type queries)
Multi get returns only documents that are found (exist).
Queries can passed as a collection of maps with three keys: :_index
,
:_type
and :_id
:
(doc/multi-get conn [{:_index index-name :_type mapping-type :_id "1"}
{:_index index-name :_type mapping-type :_id "2"}])
2-argument version accepts an index name that eliminates the need to include
:_index
in every query map:
(doc/multi-get conn index-name [{:_type mapping-type :_id "1"}
{:_type mapping-type :_id "2"}])
3-argument version also accepts a mapping type that eliminates the need to include
:_type
in every query map:
(doc/multi-get conn index-name mapping-type [{:_id "1"}
{:_id "2"}])
Multi get returns only documents that are found (exist). Queries can passed as a collection of maps with three keys: `:_index`, `:_type` and `:_id`: ```clojure (doc/multi-get conn [{:_index index-name :_type mapping-type :_id "1"} {:_index index-name :_type mapping-type :_id "2"}]) ``` 2-argument version accepts an index name that eliminates the need to include `:_index` in every query map: ```clojure (doc/multi-get conn index-name [{:_type mapping-type :_id "1"} {:_type mapping-type :_id "2"}]) ``` 3-argument version also accepts a mapping type that eliminates the need to include `:_type` in every query map: ```clojure (doc/multi-get conn index-name mapping-type [{:_id "1"} {:_id "2"}]) ```
(present? conn index mapping-type id)
Returns true if a document with the given id is present in the provided index with the given mapping type.
Returns true if a document with the given id is present in the provided index with the given mapping type.
(put conn index mapping-type id document)
(put conn index mapping-type id document opts)
Creates or updates a document in the search index using the provided document id and waits for the response.
Creates or updates a document in the search index using the provided document id and waits for the response.
(put-search-template connid id document)
(put-search-template connid language id document)
Updates a search template in the .scripts index. Templates are expressed
as maps similar to:
{:template {:filter {:term {:name "{{name}}"}}}}
Updates a search template in the .scripts index. Templates are expressed as maps similar to: `{:template {:filter {:term {:name "{{name}}"}}}}`
(replace conn index mapping-type id document)
Replaces document with given id with a new one
Replaces document with given id with a new one
(scroll conn scroll-id)
(scroll conn scroll-id opts)
Performs a scroll query, fetching the next page of results from a query given a scroll id
Performs a scroll query, fetching the next page of results from a query given a scroll id
(scroll-seq conn prev-resp)
(scroll-seq conn prev-resp {:keys [search_type]})
Returns a lazy sequence of all documents for a given scroll query
Returns a lazy sequence of all documents for a given scroll query
(search conn index mapping-type)
(search conn index mapping-type opts)
Performs a search query across one or more indexes and one or more mapping types.
Multiple indexes or types can be passed in as a seq of strings.
Examples:
(require '[clojurewerkz.elastisch.native.document :as doc])
(require '[clojurewerkz.elastisch.query :as q])
(doc/search conn "people" "person" {:query (q/prefix {:username "appl"})})
Performs a search query across one or more indexes and one or more mapping types. Multiple indexes or types can be passed in as a seq of strings. Examples: ```clojure (require '[clojurewerkz.elastisch.native.document :as doc]) (require '[clojurewerkz.elastisch.query :as q]) (doc/search conn "people" "person" {:query (q/prefix {:username "appl"})}) ```
(search-all-indexes-and-types conn)
(search-all-indexes-and-types conn opts)
Performs a search query across all indexes and all mapping types. This may put very high load on your Elasticsearch cluster so use this function with care.
Performs a search query across all indexes and all mapping types. This may put very high load on your Elasticsearch cluster so use this function with care.
(search-all-types conn index)
(search-all-types conn index opts)
Performs a search query across one or more indexes and all mapping types.
Multiple indexes can be passed in as a seq of strings.
Performs a search query across one or more indexes and all mapping types. Multiple indexes can be passed in as a seq of strings.
(suggest conn indices suggest-type term opts)
Suggests similar looking terms based on a provided text by using a suggester.
Usage:
(suggest es-conn "locations" :completion "Stockh" {:field "suggest" :size 5})
Suggests similar looking terms based on a provided text by using a suggester. Usage: `(suggest es-conn "locations" :completion "Stockh" {:field "suggest" :size 5})`
(update-with-partial-doc conn index mapping-type id partial-doc)
(update-with-partial-doc conn index mapping-type id partial-doc opts)
Updates an existing document in the search index with given partial document
Updates an existing document in the search index with given partial document
(update-with-script conn index mapping-type id script)
(update-with-script conn index mapping-type id script params)
(update-with-script conn
index
mapping-type
id
script
params
{upsert :upsert :as optional-params})
Updates a document using a script
Updates a document using a script
(upsert conn index mapping-type id doc)
(upsert conn index mapping-type id doc opts)
Updates or creates a document using provided data
Updates or creates a document using provided data
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close