Search Issue - with elasticsearch-mapper-attachments 3.1.2 plugin


(Yogesh Koli) #1

Hello,

I am running mapper plugin, I am able to index a document successfully also when I tried to run following search with terminal it works correctly:

curl -X GET 'localhost/test/person/_search' -d '
{
"fields": [],
"query": {
"match": {
"file.content": "king queen"
}
},
"highlight": {
"fields": {
"file.content": {
}
}
}
}'

But the issue is when I am trying to do same thing using PHP curl it showing following output:

{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "person",
"_id" : "1",
"_score" : 1.0,
"_source":{
"file": "IkdvZCBTYXZlIHRoZSBRdWVlbiIgKGFsdGVybmF0aXZlbHkgIkdvZCBTYXZlIHRoZSBLaW5nIg=="
}
}
]
}
}

Here is my PHP code:

<?php require __DIR__ . '/vendor/autoload.php'; use Curl\Curl; $curl = new Curl(); $data = [ "fields" => [], "query" => [ "match" => [ "file.content" => "king queen" ] ], 'highlight' => [ "fields" => [ "file.content" => [] ] ] ]; $curl->get('localhost:9200/test/person/_search?pretty=true', json_encode($data)); echo $curl->response; ?>

is there anything extra we need while accessing it from PHP?


(system) #2