Filtering for two chars strings on keyword field does not work?

Hi all,
I cannot understand how to filter for two chars strings a simple keyword field. I created the field like this:

"tags": {
  "store": True,
  "type":  "keyword"
},

..the "tags" field is then populated with a list (i.e. [''ai", "iot"] and filtered using:

"query": {
  "terms":{
    "tags": tags
  }

..which works fine for filtering documents tags by "iot", but does not return any result when filtering by "AI".

..what am I missing? I Googled and dived in the official doc for hours but I cannot figure it out. The only references that I found about a minimum length are referred to ngrams, which I am not using (right?).

Thank you!
Stefano.

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

Nevermind, it was a case-sensitiveness problem together with poor test coverage on my code.

Sorry for not having posted a full recreation script, I would have spotted the problem and avoided a useless topic. My bad.

So the answer is no, it is not true that filtering for two chars strings on keyword field does not work. But check for case as it is a case sensitive field.

Cheers,
Stefano.

Sorry for not having posted a full recreation script, I would have spotted the problem and avoided a useless topic. My bad.

:wink:

No worries. That's why we are often asking for simple recreation script as most of the time users are finding themselves what the problem is and how to solve.

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