Class: Elasticband::Search
- Inherits:
-
Object
- Object
- Elasticband::Search
- Defined in:
- lib/elasticband/search.rb
Class Method Summary collapse
-
.parse(query_text, options) ⇒ Object
Parses a query text with options to a Elasticsearch search syntax.
Class Method Details
.parse(query_text, options) ⇒ Object
Parses a query text with options to a Elasticsearch search syntax. See Elasticband::Query.parse and Elasticband::Aggregation.parse options for details.
#### Examples “‘ Search.parse(’foo’, on: :name, group_by: :status)
> {
query: { match: { name: 'foo' } },
aggs: { status: { terms: { field: :status } } },
sort: [{name: 'desc'}, '+created_at']
}
“‘
16 17 18 19 20 21 22 |
# File 'lib/elasticband/search.rb', line 16 def parse(query_text, ) { sort: Sort.parse(), query: Query.parse(query_text, ), aggs: Aggregation.parse() }.reject { |_, value| value.blank? } end |