Need some help for fuzzysearch in es

Hi, i would like to make a fuzzysearch with elasticsearch php client.

I try the follow code:

$params = [
	    'index' => 'bank',
	    'type' => 'account',
	    'size' => 1000,
	    'body' => [
	        'query' => [
	            'match' => [
	                'address' => [
	                	'query' => 'Avenue Bath',
	                	'fuzziness' => 'AUTO',
	                	'operator' => 'and'
	                ]
	            ]
	        ]
	    ]
	];

I got the right results where address has avenue and bath. But what is if i want results even i enter only some characters like ave and ba?

Do i need an analyzer for this or how can i make this work?

thanks for helping...

Hey,

I am not sure if you want to do a fuzzy search here. Fuzzy means, that there is a certain amount of changes allowed (with a maximum edit distance of 2). Your example looks rather like a prefix query. You might want to checkout the match ohrase prefix query.

Another idea to take into account for similar searches would be a phonetic search, see the Phonetic Matching docs in the definitive guide.

Hope this helps.

--Alex

hi, i try this but i dont get it to work. i have a problem. if i enter the words "Avenue" and "Bath" everything is working fine , but if i change it to "Bath" and "Avenue" nothing is found, the same with phrase like "ba" and "ave". MAybe i need a ngram token filter or something like this? thanks