我有一个已编入索引的文件,其名称字段现在名称为'dhiraj chetry'
我想写一个查询只用' dhi'关键字进行搜索?我该怎么办?
我试过 -
$indexParams = [
'index' => 'my company',
'type' => 'interns',
'body' => [
'query' =>[
'match' => [
'name' => 'dhi'
]
]
],
];
它给出了
Array ( [took] => 3 [timed_out] => [_shards] => Array ( [total] => 5 [successful] => 5 [skipped] => 0 [failed] => 0 ) [hits] => Array ( [total] => 0 [max_score] => [hits] => Array ( ) ) )
结果
答案 0 :(得分:0)
这可能会对您有所帮助:
$indexParams = [
'index' => 'my company',
'type' => 'interns',
'body' => [
'query' =>[
'term' => [
'name' => 'dhi'
]
]
]
];