Skip to content

Instantly share code, notes, and snippets.

@vibindhas
Created September 3, 2012 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vibindhas/3606794 to your computer and use it in GitHub Desktop.
Save vibindhas/3606794 to your computer and use it in GitHub Desktop.
facet filter for multi array field
authordetailsarray.authornamearray.notanalyzed is a not Analyzed field, has values as ["aaaa","bbbb"]
my search and facet filter is...
{
"from" : 0,
"size" : 10,
"query" : {"bool":{"must":{"bool":{"should":[{"query_string":{"query":"aaaa","fields":["content"],"use_dis_max":true}}}}}},
"facets" : {
"count" : {
"terms" : {
"field" : "authordetailsarray.authornamearray.notanalyzed",
"size" : 2000
},
"facet_filter" : {
{
"and" : {
"filters" : [ {
"term" : {
"authordetailsarray.authornamearray.notanalyzed" : "xxxx"
}
} ]
}
}
}
}
}
}
when I apply the facet, I am getting the facet result as...
aaaa - 1
bbbb - 1
for my case I need only
aaaa - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment