Terms Faceting based on the value of another data point

Hello,

I am trying to run a terms facet based on the data below, however the
condition for inclusion is based on another field. So as an example, in
the data below, I want to create a facet based on "user.metadata.response"
BUT only when "user.metadata.parameterid" = key1. Is this possible? I have
tried several things but I figure out how to get that to work - if it is
even possible.

{
"user":{
"status":{
"completionpercentage":43
},
"metadata":[
{
"parameterid":"key1",
"response":"South"
},
{
"parameterid":"key2",
"response":"Red"
}
]
}
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Make sure, metadata is a nested field (
Elasticsearch Platform — Find real-time answers at scale | Elastic), then
use a facet filter. I think something like this might do the trick:

"facets" : {
"metaResponse" : {
"terms" : {
"field" : "user.metadata.response"
},
"facet_filter" : {
"nested" : {
"path" : "user.metadata",
"query" : {
"term" : {
"user.metadata.parameterid" : "key1"
}
}
}
},
"nested" : "user.metadata"
}
}

Thanks,
Matt Weber

On Tue, Jul 2, 2013 at 11:53 AM, Jason Fill jasonfill@gmail.com wrote:

Hello,

I am trying to run a terms facet based on the data below, however the
condition for inclusion is based on another field. So as an example, in
the data below, I want to create a facet based on "user.metadata.response"
BUT only when "user.metadata.parameterid" = key1. Is this possible? I have
tried several things but I figure out how to get that to work - if it is
even possible.

{
"user":{
"status":{
"completionpercentage":43
},
"metadata":[
{
"parameterid":"key1",
"response":"South"
},
{
"parameterid":"key2",
"response":"Red"
}
]
}
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.