# Double facets

**URL:** <https://discuss.elastic.co/t/double-facets/8903>\
**Category:** Elasticsearch\
**Created:** [August 31, 2012, 2:09pm UTC](https://discuss.elastic.co/t/double-facets/8903 "2012-08-31T14:09:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pere\_roca\_ristol](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@pere\_roca\_ristol](https://discuss.elastic.co/u/pere_roca_ristol)\
**Post date:** [August 31, 2012, 2:09pm UTC](https://discuss.elastic.co/t/double-facets/8903/1 "2012-08-31T14:09:00Z")

</div>

hi, I want to to group all the data that share exactly the same location  
(same latitude and longitude fields).

I tried something like this, without success

curl -XGET http://www.my\_server:9200/idx\_occurrence/Occurrence/\_search?pretty=true -d '{  
"query": {  
"query\_string" : {  
"fields" : ["genus\_interpreted","dataset"],  
"query": "Pica 2",  
"default\_operator" : "AND"  
}  
},  
"facets": {  
"test": {  
"terms": {  
"fields" :["decimalLatitude","decimalLongitude"],  
"size" : 500000000  
}  
}  
}  
}'

I think the best way would be to add a new fields in data:  
latittude\_longitude and simply do a facet against it, but for me is now a  
little complicated to change the data.

It seems like Script  
([http://www.elasticsearch.org/guide/reference/query-dsl/script-filter.html](http://www.elasticsearch.org/guide/reference/query-dsl/script-filter.html))  
could help but I am not able to figure out how to get it work (and not  
fully understand how to structure the idea, honestly)

thanks in advance,

Pere

--

---

<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, 3:14am UTC](https://discuss.elastic.co/t/double-facets/8903/2 "2017-07-06T03:14:26Z")

</div>

Closed on July 6, 2017, 3:14am UTC


