I'm converting a project developed with Codeigniter into pure php. However, the project developed with codeigniter used Elasticsearch and I haven't Elastichsearch experience. I need to convert the Elasticsearch dsl query that I have shared below into a sql query to use in pure php. I tried to write the sql query. But I couldn't understand what tables he was going to. Can you help with this?
`` `Here function in controller in codeigniter (old project)
$elastic_blok_listesi = $this->elastic_model->plaka_takip_blok_ara($cari_id,$sayfa,$size);
$elastic_blok_listesi = $elastic_blok_listesi['hits']['hits'];
` ``
`` `Here function in Elasticsearch Model in codeigniter (old project)
public function plaka_takip_blok_ara($cari_id=NULL, $page=0, $size=10, $all=NULL)
{
if($all == TRUE){
$json =
'{
"size" : 4000,
"sort" : [
{"blok_no" : {"order" : "desc"}}
],
"query": {
"term": {
"firma_id":"'.$cari_id.'"
}
}
}'
;
}else{
$from = ($page-1)*$size;
$json =
'{
"from" : '.$from.', "size" : '.$size.',
"sort" : [
{"blok_no" : {"order" : "desc"}}
],
"query": {
"term": {
"firma_id":"'.$cari_id.'"
}
}
}'
;
}
$this->qParam['body'] = $json;
return $this->client->search($this->qParam);
}
` ``
`` `Here My sql in pure php (new project)
$db->query("
SELECT *
FROM ?
WHERE firma_id='$cari_id'
ORDER BY blok_no DESC
");
` ``