Lets assume that test_facet is an array with two fields: field_name and
field_value. The following request:
{
"facets":{
"test_facet":{
"terms":{
"field":"test_array.field_name",
}
}
}
}
will return facet grouping by field_name.
Now I want to get grouping by field_name + ":" + field_value.
Using something like this:
{
"facets":{
"test_facet":{
"terms":{
"field":"test_array.field_name",
"script":"term + ":" + field_value"
}
}
}
}
unfortunatelly does not work.
Do you know if it is possible to get such grouping? If it is possible then
how ?
You want to access field_value from the doc? In this case, you need to do
doc.field_value.value. But note, if both are multi valued, then there won't
be any ordering guaranteed between them (the field_name and field_value).
Lets assume that test_facet is an array with two fields: field_name and
field_value. The following request:
{
"facets":{
"test_facet":{
"terms":{
"field":"test_array.field_name",
}
}
}
}
will return facet grouping by field_name.
Now I want to get grouping by field_name + ":" + field_value.
Using something like this:
{
"facets":{
"test_facet":{
"terms":{
"field":"test_array.field_name",
"script":"term + ":" + field_value"
}
}
}
}
unfortunatelly does not work.
Do you know if it is possible to get such grouping? If it is possible then
how ?
Thank you Shay, I found the answer using complicated scripts (not so
efficient) in other posts. I guess the best way here is to reorganize
document structure to do it other way
You want to access field_value from the doc? In this case, you need to do
doc.field_value.value. But note, if both are multi valued, then there won't
be any ordering guaranteed between them (the field_name and field_value).
Lets assume that test_facet is an array with two fields: field_name and
field_value. The following request:
{
"facets":{
"test_facet":{
"terms":{
"field":"test_array.field_name",
}
}
}
}
will return facet grouping by field_name.
Now I want to get grouping by field_name + ":" + field_value.
Using something like this:
{
"facets":{
"test_facet":{
"terms":{
"field":"test_array.field_name",
"script":"term + ":" + field_value"
}
}
}
}
unfortunatelly does not work.
Do you know if it is possible to get such grouping? If it is possible
then how ?
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.