Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-elastic Reference Manual, version 0.0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 03:44:58 2022 GMT+0.
• Introduction | What cl-elastic is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
This project is supposed to be a simple interface for Elasticsearch. The emphasis is on simple, i.e. this is not supposed to be a DSL on top of another DSL. You should be able go to the Elasticsearch docs and translate that immediatly into working code. If you are looking for a DSL checkout the section about other work.
Update: 29.11.2019
The library is now in quicklisp.
You can now simply do (ql:quicklisp :cl-elastic)
to load cl-elastic.
(ql:quicklisp :cl-elastic)
(use :cl-elastic)
(defvar *client* (make-instance '<client> :endpoint "http://localhost:9200"))
;; creates an index named `elasticsearch-test`
(send-request *client* '("elasticsearch-test") :method :put)
You can enable keyword
arguments which lets you use keywords as keys in
hashtable and parameter plists as well as uri construction.
The transformation is always to lowercase.
(setq *enable-keywords* t)
(send-request *client* '(:elasticsearch-test) :method :put)
The library uses the yason library under
the hood to map between lisp objects and JSON. As hashtables are therefore
ubiquitous for JSON construction the library also exports a simple reader syntax
for literal hashmap construction. The syntax is #{key1 value1 key2 value2 ...}
.
For the enabling and disabling of the syntax the library uses
named-readtables.
(in-readtable hashtable-syntax)
(defvar foo "bar")
;; creates a hashmap with ("bar" 1) and ("foo" 2) as key/value pairs
#{foo 1 "foo" 2}
(in-readtable :standard)
For the remaining examples we are assuming that *enable-keywords*
is set to
true and the above hashtable syntax is enabled. The following examples
assume that you are using Elasticsearch version 7.0.0 or above,
otherwise you might need to adapt the index settings.
;; create a index with a test field of type text
(send-request *client* :elasticsearch-test :method :put
:data #{:settings #{:number_of_shards 1}
:mappings #{:properties #{:test #{:type "text"}}}})
;; create a document with id 3
(send-request *client* '(:elasticsearch-test :_doc 3) :method :put
:data #{:test "toto"})
;; find a document by id
(send-request *client* '(:elasticsearch-test :_doc 3) :method :get)
;; search for something
(send-request *client* '(:elasticsearch-test :_search) :method :get
:data #{:query #{:term #{:test "toto"}}})
;; delete the document
(send-request *client* '(:elasticsearch-test :_doc 3) :method :delete)
;; for bulk requests you can pass a list of operations as data
(send-request *client* :_bulk :method :post
:data (list
#{:index #{:_index :elasticsearch-test :_id 3}}
#{:test "foo"}
#{:index #{:_index :elasticsearch-test :_id 2}}
#{:test "bar"}
#{:delete #{:_index :elasticsearch-test :_id 3}}))
There are a couple of other clients, although non of them are in quicklisp:
clesc
cl-elasticsearch
eclastic
cl-async
.MIT Licence
Copyright (c) 2019 Finn Völkel (firstname.lastname@gmail.com
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The cl-elastic system |
Finn Völkel
MIT
Elasticsearch client for Common Lisp
0.0.1
cl-elastic.asd (file)
cl-elastic.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The cl-elastic.asd file | ||
• The cl-elastic/cl-elastic.lisp file |
Next: The cl-elastic/cl-elastic․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
cl-elastic.asd
cl-elastic (system)
Previous: The cl-elastic․asd file, Up: Lisp files [Contents][Index]
cl-elastic (system)
cl-elastic.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The cl-elastic package |
cl-elastic.lisp (file)
elastic
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported generic functions | ||
• Exported classes |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
If set to a true value, keywords will be transformed to strings in JSON objects and read back as keywords.
cl-elastic.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
cl-elastic.lisp (file)
cl-elastic.lisp (file)
Next: Exported generic functions, Previous: Exported macros, Up: Exported definitions [Contents][Index]
Sends a request to an Elasticsearch client.
cl-elastic.lisp (file)
Next: Exported classes, Previous: Exported functions, Up: Exported definitions [Contents][Index]
automatically generated reader method
cl-elastic.lisp (file)
automatically generated reader method
cl-elastic.lisp (file)
automatically generated reader method
cl-elastic.lisp (file)
Previous: Exported generic functions, Up: Exported definitions [Contents][Index]
cl-elastic.lisp (file)
standard-object (class)
:endpoint
"http://localhost:9200"
endpoint (generic function)
:user
user (generic function)
:password
password (generic function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions | ||
• Internal conditions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
cl-elastic.lisp (file)
Next: Internal conditions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
cl-elastic.lisp (file)
Concats STRINGS with newlines. Ends in a newline.
cl-elastic.lisp (file)
cl-elastic.lisp (file)
Transforms a lisp object into a JSON object in string form. A list is transformed into the newline seperated concatenation of JSON objects.
cl-elastic.lisp (file)
cl-elastic.lisp (file)
cl-elastic.lisp (file)
Creates a keyword symbol for a given string NAME.
cl-elastic.lisp (file)
Parses a URI in form of a string, keyword or list.
cl-elastic.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
cl-elastic.lisp (file)
error (condition)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | C F L |
---|
Jump to: | C F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | #
C D E F G K M P S U |
---|
Jump to: | #
C D E F G K M P S U |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
E P S U |
---|
Jump to: | *
E P S U |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | <
C O P S |
---|
Jump to: | <
C O P S |
---|