Problem:
I'm using a simple match query to return some results with filtered stop words. But if a stop word is searched for with a simple match query, it will have 0 hits since it's unable to match stop words which are already filtered out.
This is my analyser:
"stopwords_analyzer": {
"filter": [
"lowercase",
"trim",
"stopwords_filter"
],
"type": "custom",
"tokenizer": "standard"
It works great in all use cases except when when trying to match stop words like:
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{"match": {"word.stopwords": "the great pyramid"}}
]
}
}
}
}
It would match results for "great pyramid", but return 0 results for "the great pyramid".
Unsuccessful solution:
Tried adding another analyser without stopwords filter as a index_analyser, and using the existing stopwords_analyser as search_analyser.
"normal_analyzer": {
"filter": [
"lowercase",
"trim"
],
"type": "custom",
"tokenizer": "standard"
From my understanding, stop words should be available after indexing, but should be filtered out when searching with queries. Yet, now it returns all results, including stop words.
Why doesn't this work? Is there an another way to search for stop words, while excluding them from results?