thanks for helping me before, so now i can explore more about elastic search.
so far, i can manipulate data using elasticsearch. i create new library in my php framework (codeigniter). after make several data input. since the best part of elastic is searching (yeah of course....), i wonder to make search feature.
but when i create it, im dissapointed with the result. unlike kibana, my result didnt show the highlight text of keywords that i input before.
question is : how to make highlight text in elastic search result
i read this article : https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-request-highlighting.html
but i dont know where to put this code :
{
"query" : {...},
"highlight" : {
"fields" : {
**"content" : {}**
}
}
}
since my code in php only like this : controller :
$product = $this->elasticsearch->searchDocsWithParameter($type, $post);
$result = json_decode(json_encode($product),true);
echo "total took:";
echo $result['took'];
$x=0; $no=1;
while($x <= $result['_shards']['total']):
echo $no; echo" . ";
echo $result["hits"]["hits"][$x]['_source']['en_question'];
echo"<br>";
echo $result["hits"]["hits"][$x]['_source']['en_answer'];
echo"<br><br>";
$x++; $no++;
endwhile;
library :
public function searchDocsWithParameter($type, $query")
{
return $this->call($type . '/_search?' . http_build_query(array('q' => $q)));
}
i already googling about it, nobody post about how it. thats why i ask to this forum. pls help me.
many thanks in return thanks