class Neuroplastic::Elastic(T)

Defined in:

neuroplastic/elastic.cr

Constant Summary

COUNT = "count"
HITS = "hits"
ID = "_id"
Log = ::Log.for("search")
SCORE = ["_score"]
SOURCE = "_source"
TOTAL = "total"
TYPE = "_document_type"
VALUE = "value"

Constructors

Instance Method Summary

Constructor Detail

def self.new(elastic_index : String | Nil = nil, document_name : String | Nil = nil) #

[View source]

Instance Method Detail

def client #

Yields the elasticsearch client


[View source]
def count(builder) #

Performs a count query against an index


[View source]
def elastic_document_name : String #

Document type defaults to class name without namespace


[View source]
def elastic_index : String #

Index defaults to rethinkdb table name


[View source]
def generate_body(builder) #

[View source]
def query(params = {} of Symbol => String | Array(String), filters = nil) #

Safely build the query


[View source]
def search(builder) #

Query elasticsearch with a query builder object


[View source]
def search(builder, &block : Proc(T, T | Nil)) #

Query elasticsearch with a query builder object, accepts a formatter block Allows annotation/conversion of records using data from the model. Nils are removed from the list.


[View source]