我有一个文件索引,在名字段中有一个名字'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 ( ) ) )作为结果
发布于 2018-04-02 18:16:43
这可能会对你有所帮助:
$indexParams = [
'index' => 'my company',
'type' => 'interns',
'body' => [
'query' =>[
'term' => [
'name' => 'dhi'
]
]
]
];https://stackoverflow.com/questions/49609207
复制相似问题