# Elasticsearch range facet parse error

**URL:** <https://discuss.elastic.co/t/elasticsearch-range-facet-parse-error/12252>\
**Category:** Elasticsearch\
**Created:** [June 4, 2013, 7:50am UTC](https://discuss.elastic.co/t/elasticsearch-range-facet-parse-error/12252 "2013-06-04T07:50:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TunaVargi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tunavargi/32/2306_2.png) [@TunaVargi](https://discuss.elastic.co/u/TunaVargi)\
**Post date:** [June 4, 2013, 7:50am UTC](https://discuss.elastic.co/t/elasticsearch-range-facet-parse-error/12252/1 "2013-06-04T07:50:48Z")

</div>

I have following query working

```
        query = {
        "query": inner_query,
        "filter": {"term": {"has_product": 1}},
        "facets": {
            "destination": {
                "terms": {"field": "hotel.destination_facets.en"},
                "facet_filter": {"term": {"has_product": 1}}
            },
            "hotel_class": {
                "terms": {"field": "hotel_class"},
                "facet_filter": {"term": {"has_product": 1}}},
            "hotel_type": {
                "terms": {"field": "hotel.hotel_type_facets.en"},
                "facet_filter": {"term": {"has_product": 1}}}}}

```

but i want to add range facet for min\_rate field, but when i have the  
following query i have Elasticsearch parse error.

```
        query = {
        "query": inner_query,
        "filter": {"term": {"has_product": 1}},
        "facets": {
            "destination": {
                "terms": {"field": "hotel.destination_facets.en"},
                "facet_filter": {"term": {"has_product": 1}}
            },
            "hotel_class": {
                "terms": {"field": "hotel_class"},
                "facet_filter": {"term": {"has_product": 1}}},
            "hotel_type": {
                "terms": {"field": "hotel.hotel_type_facets.en"},
                "facet_filter": {"term": {"has_product": 1}}},
            "min_rate": {
                "range": {"min_rate": [
                    {"from": "hotel.min_rate_start",
                     "to": "hotel.min_rate_end"}]}}}}

```

Any ideas?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 4, 2013, 8:17am UTC](https://discuss.elastic.co/t/elasticsearch-range-facet-parse-error/12252/2 "2013-06-04T08:17:03Z")

</div>

Look at range facet documentation: [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/api/search/facets/range-facet/)  
{  
"min\_rate":{  
"range":{  
"min\_rate":[  
{  
"from":"hotel.min\_rate\_start",  
"to":"hotel.min\_rate\_end"  
}  
]  
}  
}  
}

from and to should be numbers

## HTH

David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 4 juin 2013 à 09:50, TunaVargı [tuna40@gmail.com](mailto:tuna40@gmail.com) a écrit :

> I have following query working
> 
> ```
> query = {
> "query": inner_query,
> "filter": {"term": {"has_product": 1}},
> "facets": {
> "destination": {
> "terms": {"field": "hotel.destination_facets.en"},
> "facet_filter": {"term": {"has_product": 1}}
> },
> "hotel_class": {
> "terms": {"field": "hotel_class"},
> "facet_filter": {"term": {"has_product": 1}}},
> "hotel_type": {
> "terms": {"field": "hotel.hotel_type_facets.en"},
> "facet_filter": {"term": {"has_product": 1}}}}}
> 
> ```
> 
> but i want to add range facet for min\_rate field, but when i have the following query i have Elasticsearch parse error.
> 
> ```
> query = {
> "query": inner_query,
> "filter": {"term": {"has_product": 1}},
> "facets": {
> "destination": {
> "terms": {"field": "hotel.destination_facets.en"},
> "facet_filter": {"term": {"has_product": 1}}
> },
> "hotel_class": {
> "terms": {"field": "hotel_class"},
> "facet_filter": {"term": {"has_product": 1}}},
> "hotel_type": {
> "terms": {"field": "hotel.hotel_type_facets.en"},
> "facet_filter": {"term": {"has_product": 1}}},
> "min_rate": {
> "range": {"min_rate": [
> {"from": "hotel.min_rate_start",
> "to": "hotel.min_rate_end"}]}}}}
> 
> ```
> 
> Any ideas?
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:33am UTC](https://discuss.elastic.co/t/elasticsearch-range-facet-parse-error/12252/3 "2017-07-06T02:33:08Z")

</div>


