Search for words with accents with the Java API

Hi guys
I am using Java API Elasticsearch 7.4 and would like to know how to do in Java to search for texts with accents, for example:

"João de Souza Antonio"

But to no avail. I've tried using Term, Match, Wildcard, but none worked. Reading more about the documentation I saw the option to use filters like:

"index" : {
    "analysis" : {
        "analyzer" : {
            "default" : {
                "tokenizer" : "standard",
                "filter" : ["standard", "my_ascii_folding"]
            }
        },
        "filter" : {
            "my_ascii_folding" : {
                "type" : "asciifolding",
                "preserve_original" : true
            }
        }
    }
}

But how would you do it in Java?

Thank you

Hi Marlon,

You'd typically set up the analysis via index templates. Then at indexing time the defined analysers will be used to create the correct indexed tokens, and at search time the same analyser is used on the search input.

The Java API supports index template, too.

Thanks for the help, that's what you needed.

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