Hello,

I’m implementing a faceted interface that requires that all the facets be 
filtered by a shared filter - below is roughly how the queries currently 
look, is there a more efficient/performant way to make this kind of query? 
Less fussed about actual query verbosity but if there some way of sharing 
or referencing the repeated facet_filter other than search templates that’d 
be fantastic.

Thanks,

Alex

{
    "facets": {
        "facetOne": {
            "facet_filter": {
                "bool": {
                    "must": [
                        {
                            "term": {
                                "foo.bar": "test"
                            }
                        },
                        {
                            "term": {
                                "baz":"test*"
                            }
                        }
                    ]
                }
            },
            "terms": {
                "field": "facetOne.field",
                "order": ["count"],
                "size": 50
            }
        },

        "facetTwo": {
            "facet_filter": {
                "bool": {
                    "must": [
                        {
                            "term": {
                                "foo.bar": "test"
                            }
                        },
                        {
                            "term": {
                                "baz":"test*"
                            }
                        }
                    ]
                }
            },
            "terms": {
                "field": "facetTwo.field",
                "order": ["count"],
                "size": 50
            }
        },

        "facetThree": {
            "facet_filter": {
                "bool": {
                    "must": [
                        {
                            "term": {
                                "foo.bar": "test"
                            }
                        },
                        {
                            "term": {
                                "baz":"test*"
                            }
                        }
                    ]
                }
            },
            "terms": {
                "field": "facetThree.field",
                "order": ["count"],
                "size": 50
            }
        }
    },
    "size": 0
}




-- 


------------------------------

*CONFIDENTIALITY NOTICE:* The information contained in this message may be 
privileged and/or confidential. It is the property of CrowdStrike.  If you are 
not the intended recipient, or responsible for delivering this message to the 
intended recipient, any review, forwarding, dissemination, distribution or 
copying of this communication or any attachment(s) is strictly prohibited. If 
you have received this message in error, please notify the sender immediately, 
and delete it and all attachments from your computer and network.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/0993b970-b60c-4e38-b42c-953394abdac1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to