2
我已經安裝了彈性搜索並在我的本地服務器中安裝了插入插件。彈性引擎運行良好。我設置了以下任務:攝取搜索(彈性搜索)不能在PHP中工作
- 映射
- 索引
現在我被困在搜索,它不工作。它返回空數組。這是我在PHP代碼:
public function ingest_processor_searching($query)
{
$client = $this->client;
$params = [
'index' => 'ingest_index',
'type' => 'attachment',
'body' => [
'query' => [
'match' => [
'textField' => $query,
]
],
],
];
$response = $client->search($params);
return $response;
}
結果:
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
但是我有數據爲GET http://localhost:9200/ingest_index/attachment/2
{
"_index": "ingest_index",
"_type": "attachment",
"_id": "2",
"_version": 1,
"found": true,
"_source": {
"file_path": "/Users/selimreza/Sites/haber_dev/public/uploads/files/bower.txt",
"attachment": {
"content_type": "text/plain; charset=ISO-8859-1",
"language": "en",
"content": "Welcome to Dhaka",
"content_length": 18
},
"textField": "V2VsY29tZSB0byBEaGFrYQo="
}
}
什麼是我做了錯誤?
如果你能證明你的映射? – Kulasangar