如何在elasticsearch中搜索文档
我想使用elasticsearch搜索我的_类型的属性 例如,在my_类型中,我有一个名为“folder_applications”的属性:如何在elasticsearch中搜索文档,search,elasticsearch,types,document,Search,elasticsearch,Types,Document,我想使用elasticsearch搜索我的_类型的属性 例如,在my_类型中,我有一个名为“folder_applications”的属性: "folder_applications": [ *[ "employer_folder_id" => 142 "status_id" => 140 "folder" => [ "id" => 142 "employer_id" => 11 ] "cre
"folder_applications": [
*[
"employer_folder_id" => 142
"status_id" => 140
"folder" => [
"id" => 142
"employer_id" => 11
]
"created_at" => "2017-04-12"
"is_applied" => 1
"hire_stage_id" => 144
],
**[
"employer_folder_id" => 7922
"status_id" => 141
"folder" => [
"id" => 7922
"employer_id" => 11
]
"created_at" => "2017-04-12"
"is_applied" => 1
"hire_stage_id" => 143
]
]
* -> first array
** -> second array
例如,这里我想在我的类型中搜索状态为_id=>141的对象
当我搜索这个时,我的搜索结果返回所有状态的hole文档。。但我只想要状态_id=>141。。。不是140或任何其他..例如,我想获取文件夹.id=>7922&&status\u id=>141。。搜索结果只显示了示例的第二个数组
其他搜索也会发生这种情况。。如何处理此问题?如果您的
文件夹应用程序
属性为,则只能使用它获取文件夹应用程序
数组中的对象。更新:示例:
{
"query":{
"nested":{
"path":"folder_applications",
"query":{
"bool":{
"must":[{"match":{
"folder_applications.status_id":141
}
},
{"nested":{
"path":"folder_applications.folder",
"query":{
"match":{
"folder_applications.folder.id":7922
}
}
}
}
]
}
},
"inner_hits":{}
}
}
}
谢谢@TarasKohut,你能给我举个例子吗?是
文件夹\u应用程序
具有嵌套类型。。。但是我不知道如何写我的查询。。因为我也有布尔查询。。我想把这些结合起来。。