elasticsearch - 来自 ES 的查询对象
问题描述
我有以下 ES 映射
"students" : {
"properties" : {
"tag" : {
"type" : "nested",
"properties" : {
"id" : {
"type" : "keyword"
},
"name" : {
"type" : "text"
}
}
},
我如何从 student->tag->id 查询,因为students
未定义为嵌套。
我需要一个可以支持多个 id 匹配的查询
解决方案
就像这样:
{
"query": {
"nested": {
"path": "students.tag",
"query": {
"term": {
"students.tag.id": "1234"
}
}
}
}
}
推荐阅读
- c - 图片编程 使用 C 计数器上下
- javascript - Webpack devserver 代理,如何避免 401 错误?
- javascript - Angular JS 的 IOS pin 用户界面
- python - SqlLite 与 SqlAlchemy CreateTable 导致数据库被锁定
- angular - 用''按日期排序表
- android - ImageDecoder 与 BitmapFactory
- reactjs - 如何在草稿js中转换字符串
- php - PHP 致命错误:在中找不到类“IntlDateFormatter”
- c# - 将数字数据类型的输入传递给 WebAPI 的标准方法?
- mysql - SQL - 如何在文本字段中搜索特定数据?例如,我需要包含 C1 + 任何字符的行,例如 C1$,而不是另一个数字,例如 C19