# Native facet script

**URL:** <https://discuss.elastic.co/t/native-facet-script/12674>\
**Category:** Elasticsearch\
**Created:** [July 5, 2013, 9:49am UTC](https://discuss.elastic.co/t/native-facet-script/12674 "2013-07-05T09:49:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Molnar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/samuel_molnar/32/2253_2.png) [@Samuel\_Molnar](https://discuss.elastic.co/u/Samuel_Molnar)\
**Post date:** [July 5, 2013, 9:49am UTC](https://discuss.elastic.co/t/native-facet-script/12674/1 "2013-07-05T09:49:31Z")

</div>

Hi,

is it possible to use native script in facets?

For example, when i run:

{  
"facets": {  
"judges": {  
"terms": {  
"field": "judges.untouched",  
"size": 10,  
"all\_terms": false,  
"global\_facets": true,  
"\_script": {  
"script": "facet\_matcher",  
"params": {  
"a": "b"  
},  
"lang": "native"  
}  
}  
}  
}

it correctly use native facet provided in elasticsearch.yml

But when i fetch more facets, elasticsearch fail to parse the query:

{  
"facets": {  
"judges": {  
"terms": {  
"field": "judges.untouched",  
"size": 10,  
"all\_terms": false,  
"global\_facets": true,  
"\_script": {  
"script": "facet\_matcher",  
"params": {  
"a": "b"  
},  
"lang": "native"  
}  
}  
},  
"judges\_selected": {  
"terms": {  
"field": "judges.untouched",  
"size": 10,  
"all\_terms": false  
},  
"global\_facets": false  
}  
}  
}

with error:  
... Parse Failure [No parser for element [judges\_selected]]]; }]

What am i doing wrong? Is is possible to use facet script like this?

Thanks

--  
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:28am UTC](https://discuss.elastic.co/t/native-facet-script/12674/2 "2017-07-06T02:28:05Z")

</div>


