Search fields without Stopwords

Hello together,

I have a question about searching fields.

My Question is how can I use an analyzer in a match_all query? The only thing I saw was when people used a analyzer on a specfic text like 'Text: "How are you"'.

Well I wan't to filter out some common words out of a field which is called "Inhalt" I think using stopwords is the right solution but Iam not sure how to use them related to a match_all query.

My goal is to get a list of often used words (keywords) without common words like (the, about, able .. and so on)

Current Search Query:
//GET _search
{
"query": {
"match_all": {}
},
"aggs": {
"nachrichten": {
"terms": {
"field": "inhalt",
"size": "1000"
}
}
},
"size": 0
}

A match_all query does exactly that - it matches all docs. I expect you are more interested in the match query.

The choice of analyzer is tied to the mapping definition for the field. The match query will automatically tokenize your search terms using the analyzer that is associated for your choice of field being queried.

Thanks for the answer.

So basically I just need to map a field with an analyzer which is using the english stopwords list for example?

Yep - if required you can configure your own analyzer with a custom set of stopwords.

1 Like

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