Skip to content

gschjetne/eclastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Eclastic

A library for interfacing with elasticsearch

Introduction

These are the humble beginnings of an elasticseach client in Common Lisp.

Work in Progress

I intend to re-write large portions of the library soon, to more easily support a greater set of Elasticsearch features.

If you want to use this for production, drop me a message for the latest status.

Examples

Setup

Tell Eclastic of a place to send requests, whether a server, an index or a type within an index:

(defparameter *my-documents* (make-instance '<type>
                                            :type "whatever"
                                            :index "highway"
                                            :host "localhost"
                                            :port 9200))

Fetching a document

Asks the server for a document. If none exists, it still returns an empty document, but a warning is signalled:

(document-by-id *my-documents* "1")

;; => #<<DOCUMENT> /highway/whatever/1 {10083980C3}>

(handler-case (document-by-id *my-documents* "no-such-doc")
  (document-not-found "Sorry, I couldn't find that document"))

;; => "Sorry, I couldn't find that document"

Searching

The query language will be accessible with native Lisp syntax:

(get* *my-documents*
      (new-search (match "adventure" "_all")))

;; => (#<<DOCUMENT> /highway/whatever/321 {10071F58E3}>
;;     #<<DOCUMENT> /highway/whatever/412 {10071F5963}>
;;     #<<DOCUMENT> /highway/whatever/431 {10071F59E3}>)
;;    (:NUM-HITS 3 :SHARDS (:TOTAL 5 :FAILED 5 :SUCCESSFUL 0) 
;;     :TIMED-OUT NIL :TOOK 3)

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http:https://www.gnu.org/licenses/.

About

A library for interfacing with elasticsearch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published