Can I use facet on script field ?
For instance, I would like to dynamically extract some field with
regex and use it to specify field facet :
{
"query": {
"match_all": {}
},
"script_fields": {
"test1": {
"lang": "groovy",
"script": "(doc['some_field'].value =~ '([a-z]).*')[0][1]"
}
},
"facets": {
"tag": {
"terms": {
"field": "test1",
}
}
}
}
Thats a script field which controls what will be returned from the actual search top N hits you ask for (the size). Each facet specifically has some support for scripting, terms as well.
On Monday, January 30, 2012 at 2:36 AM, Olivier wrote:
Hi,
Can I use facet on script field ?
For instance, I would like to dynamically extract some field with
regex and use it to specify field facet :
{
"query": {
"match_all": {}
},
"script_fields": {
"test1": {
"lang": "groovy",
"script": "(doc['some_field'].value =~ '([a-z]).*')[0][1]"
}
},
"facets": {
"tag": {
"terms": {
"field": "test1",
}
}
}
}
Thats a script field which controls what will be returned from the actual search top N hits you ask for (the size). Each facet specifically has some support for scripting, terms as well.
On Monday, January 30, 2012 at 2:36 AM, Olivier wrote:
Hi,
Can I use facet on script field ?
For instance, I would like to dynamically extract some field with
regex and use it to specify field facet :
{
"query": {
"match_all": {}
},
"script_fields": {
"test1": {
"lang": "groovy",
"script": "(doc['some_field'].value =~ '([a-z]).*')[0][1]"
}
},
"facets": {
"tag": {
"terms": {
"field": "test1",
}
}
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.