I have installed elastic search and also install ingest plugin in my local server. Elastic engine is running nicely. I set up the following tasks:
- mapping
- indexing
Now I am stuck in searching, it's not working. It returns null array. Here is my code in 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;
}
Result:
{
"took": 7,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
But I have Data for the 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="
}
}
What is the mistake I did?