Skip to content

CriztianiX/eluastica

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

eluastica

A Moonscript/lua elasticsearch library based on concept of http://elastica.io

!!! WARNING !!! This is still under development, only a few classes has been implemented!

Moonscript examples

Creating a query

Take a look at eluastica/query directory for a complete list of implemented queries

import EluasticaQueryMatchAll from require "eluastica.query.match_all"

match_all = EluasticaQueryMatchAll!

Creating a filter

Take a look at eluastica/filter directory for a complete list of implemented queries

import EluasticaFilterTerms from require "eluastica.filter.terms"

names = EluasticaFilterTerms 'Document.name', {'Juan', 'Luis', 'Pedro'}
names\setParam "execution", "or"

Connecting to Elasticsearch

import EluasticaConnection from require "eluastica.connection"

connection = EluasticaConnection!
connection\setHost "HOST"
connection\setPort "PORT"

Creating a request

import EluasticaRequest from require "eluastica.request"

request = EluasticaRequest!
request\setConnection connection
request\setMethod EluasticaRequest.GET

Putting it together

import EluasticaQueryFiltered from require "eluastica.query.filtered"
import EluasticaQuery from require "eluastica.query"

query_filtered = EluasticaQueryFiltered!
query_filtered\setQuery match_all
query_filtered\setFilter names

elastic_query = EluasticaQuery!
elastic_query\setQuery query_filtered
elastic_query\setSize 10
elastic_query\setPage 1

Sending the request

request\setPath "/your-index/your-type/_search"
request\setQuery elastic_query\toArray!
results = request\send!

About

Elasticsearch library for lua based on http://elastica.io/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published