Search with range on field

9 views
Skip to first unread message

Christophe Moins

unread,
Nov 13, 2012, 11:49:31 AM11/13/12
to elasti...@googlegroups.com
Hi
I'm trying to make a query with a range on a field, for example for a price between $10 adn $20
I can't find anything about this on elastictastic documentation.

Is there someone to help me?

Thanks

Matthew A. Brown

unread,
Nov 13, 2012, 11:59:46 AM11/13/12
to elasti...@googlegroups.com
Hi Christophe,

Elastictastic doesn't put any abstraction on top of ElasticSearch's query DSL, so you can form any query that ElasticSearch allows: http://www.elasticsearch.org/guide/reference/query-dsl/

So for your example, you'd just want to do something like:

Product.query(constant_score: {filter: {range: {price: {from: 10, to: 20}}}})

Hope that helps!
Mat


--
 
 

Christophe Moins

unread,
Nov 15, 2012, 6:11:30 AM11/15/12
to elasti...@googlegroups.com
perfect !

thank you
Reply all
Reply to author
Forward
0 new messages