Use Custom Stop Words in Custom Terms Query

I want to be able to define a custom list of stop words when doing a custom term query, rather than using high and low frequency terms. Is this possible?

Sure.
To use your own stopwords with say standard analyzer, just create a custom version of the analyzer and pass in the list of stopwords you need:

PUT /anyindex
{
  "settings": {
    "analysis": {
      "analyzer": {
        "custom_analyzer": { 
          "type": "standard", 
          "stopwords": [ "unique", "rare" ] 
        }
      }
    }
  }
}

You either leverage this analyzer during query time, as you wanted, or during indexing. Although it would make sense to use it during indexing, to make sure your content gets similar treatment while getting indexed.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.