Search for word without spaces if query contains spaces

Hello maybe someone can help me,

I'm using Multimatch Query with Fuzzy search to build a search and it's working pretty good.

My query:

{"from":0,"size":30,"query": {"bool":{"should":[ {"multi_match":{ "query":"Farbe", "fields": ["name1","name2","city1","postalCode"]}}, {"match":{"name1":{"_name":"name1","query":"Farbe","fuzziness":1,"prefix_length":3,"max_expansions":50}}}, {"match":{"name2":{"_name":"name2","query":"Farbe","fuzziness":1,"prefix_length":3,"max_expansions":50}}}, {"match":{"city1":{"_name":"city1","query":"Farbe","fuzziness":1,"prefix_length":3,"max_expansions":50}}}, {"match":{"postalCode":{"_name":"postalCode","query":"Farbe","fuzziness":1,"prefix_length":3,"max_expansions":50}}}]}}}

The only thing that doesn't work is if I search for e.g.

when the correct entry would be: Mexico City.

I think I need an analyzer for my search term.

Is this kind of search correction possible with ES?
Would be great if I don't have to modify my data definition in the database.

You can use the wildcard parameter for this. Here's an example:

{ "wildcard": { "fieldname": "*need*" } }

This will match every word that has the word need in it.

Hi Lukas,

Here is the link to one of the post that solves your problem hope this helps.