Nested facet filters


(Wojciech Durczyński) #1

Hello Shay.
I have some problems with facets on nested documents.
Let's say my documents have following structure (contain name and list of
specifications, and each specification contains name and list of
characteristics, specifications have "nested" mapping):
{
"name":"off8",
"specifications":[{
"name":"1",
"characteristics":[{
"color":"blue"
},{
"size":"small"
},{
"color":"blue"
}]
},{
"name":"5",
"characteristics":[{
"color":"blue"
}]
}]
}

I can facet on colors in root context (how many documents have particular
color):
termsFacet("color").field("specifications.characteristics.color")

Also I can easily facet on names of specifications that contain color blue:
termsFacet("blue
specs").field("specifications.name").nested("specifications").facetFilter(
termFilter("specifications.characteristics.color", "blue")
)

But I cannot add in previous example:

  1. filter on root document, something like:
    termsFacet("blue
    specs").field("specifications.name").nested("specifications").facetFilter(
    andFilter(termFilter("specifications.characteristics.color",
    "blue"), prefixFilter("name", "off"))
    )
  2. global scope to ignore query and filters

Is it possible? Maybe facetFilters set on nested facet should have their own
scopes?

Regards
Wojciech Durczyński


(system) #2