parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

How to Implement Boolean Filter #135

Open ErenPhayte opened 8 years ago

ErenPhayte commented 8 years ago

Hi,

Its not 100% clear how to filter using Boolean . I have a category in elastic search that I need to filter on but its returning more than just that category. Any idea?

ErenPhayte commented 8 years ago

I feel like the clue is where I need to set a filter:

"query": {
    "bool": {
      "filter": [
        { "term":  { "custom_category": "custom_keyword" }}
      ]
  }
}

using add_filter('elasticsearch_searcher_query' ...

So that the results ONLY get that custom_category and nothing else.