I have added 15k records in elasticsearch index products_idx1 and type product.
In records product name like apple iphone 6 so when I search for iphone6 it returns empty data.
Here is my code in php elasticsearch
<?php
use Elasticsearch\ClientBuilder;
require 'vendor/autoload.php';
$client = ClientBuilder::create()->build();
$values =['name','name.prefix','name.suffix','sku'];
$params =
[
'client'=>['verify'=>1,'connect_timeout'=>5],
'from'=> 0,
'size'=>25,
'body' =>[
'query' => [
'bool'=>
[
'should'=> [[
'multi_match'=> ['query'=>'iphone6','type'=>'cross_fields','fields'=>$values,'operator'=>'OR']
],
['match'=>['all'=>['query'=>'iphone6','operator'=>'OR','fuzziness'=>'AUTO'] ]]
]
]
],
'sort'=>['_score'=>['order'=>'desc']],
],
'index'=>'products_idx1'
];
$response = $client->search($params);
echo "<pre>";print_r($response);
prefixqueries that might help some of this and you could set up another field variant where all spaces get removed as an alternate analysis. There are a lot of options