0
votes

I've got some documents stored in ElasticSearch like this:
{ "tag" : ["tag1", "tag2", "tag3"] ... }

I want to search through the "tag" field. I know that It should work with a query like:
{ "query": { "match" : {"tag" : "tag1"} } }

But, I don't want to use a match, I want to use a fuzzy search through the list, for example, something like:
{ "query": { "fuzzy" : {"tag" : "tagg1"} } }
The problem is, the above query doesn't return anything. What should I use instead?

1

1 Answers

0
votes

What is the type of tag field in your elasticsearch mapping ?

I have tried with following type for tag field & elastisearch version is 7.2

"tag" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }

And working well for me.

Query With elastic fuzzy will be :

{
  "query":
    {
        "fuzzy": {"tag" : "tagg1"}
    }
 }