在my API中实现elasticsearch php客户端的建议功能
我试图在API中实现elasticsearch php客户端的建议功能,向人们建议一些已经存在的问题。 我已经为我的问题做了索引在my API中实现elasticsearch php客户端的建议功能,php,
elasticsearch,Php,
elasticsearch,我试图在API中实现elasticsearch php客户端的建议功能,向人们建议一些已经存在的问题。 我已经为我的问题做了索引 'index' => 'newproblemindex', 'body' => [ 'settings' => [ 'number_of_shards' => 3, 'number_of_replicas' => 2
'index' => 'newproblemindex',
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'newproblems' => [ // type of index
'_source' => [
'enabled' => true
],
'properties' => [
'title' => [
'type' => 'text',
'analyzer' => 'standard'
],
'description' => [
'type' => 'text',
'analyzer' => 'standard'
], 'suggest' => [
'type' => 'completion'
]
]
]
]
]
但我无法找到用于实现建议功能的参数字段
'index' => 'newproblemindex',
'body' => [
'try' => [
'text' => $request->search_key,
'completion' => [ 'text' => 'suggest' ]
]
],
我正在使用laravel并将search_key作为请求参数,但是我得到了“invalid_type_name_exception”,当我试图给出类型名时,它再次给我一些错误
"suggest" => [
"song-suggest" => [
"prefix" => $request->search_key,
"completion" => ["field" => "suggest"]
]
]
我收到错误“建议不是有效参数”。请帮忙
提前感谢。Gey您找到解决方案了吗!!没有人@Ahmedbhs