我有一个Codeigniter应用程序,尝试在其中设置elasticsearch,我的json如下所示:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "features",
"_type": "liste",
"_id": "test",
"_score": 1.0,
"_source": {
"mnuActiveSection": "securite.features",
"rowsFeatures": [
{
"id": "50",
"idCategory": "5",
"Name": "01- Data",
"FeatureCategory": "Serie",
"NombrePrivileges": "9",
"ListePrivileges": "Admin"
},
{
"id": "51",
"idCategory": "5",
"Name": "02- Data 2",
"FeatureCategory": "Documentary",
"NombrePrivileges": "3",
"ListePrivileges": "Direction"
},
{
"id": "52",
"idCategory": "5",
"Name": "03- Data 3",
"FeatureCategory": "Films",
"NombrePrivileges": "7",
"ListePrivileges": "Super Admin"
}
]
}
}
]
}
}
我想在我的视图中显示功能列表,并通过弹性搜索来搜索文档。不幸的是,我无法显示数据json。
这不是我想要的,因为我的印象是我将所有数据分组在一个对象数组中。 为此,我尝试使用“ foreach”,但不幸的是我没有得到想要的东西。我现在还停留在这个阶段。 我希望表中的每个数据都具有不同的_id,例如,以便更好地可视化它们。
public function liste()
{
$data["mnuActiveSection"] = "securite.features";
$Finder = new FeaturesFinder();
$data["rowsFeatures"] = $Finder->FindAll();
$this->load->library('elasticsearch');
foreach($data["rowsFeatures"] as $d){
$this->elasticsearch->index = 'features';
$this->elasticsearch->create();
$this->elasticsearch->add($type ='liste',$id = 'test',$data);
var_dump($d);
}
}
如果有人可以帮助我找到我感兴趣的曲目。
非常感谢
答案 0 :(得分:0)
我认为您要这样做的是
pci_release_regions()