elasticsearch - 谁能帮我从弹性搜索中查询
问题描述
我想访问图像中的航班数组并获取 10 x 10 的记录。我通过映射航班数组尝试了不同的方法。这是我在邮递员中尝试过的
PUT http://12.234.17.134:9200/index-flights
{
"mappings": {
"properties": {
"flights": {
"type": "nested"
}
}
}
}
GET http://12.234.17.134:9200/index-flights/_search
{
"query": {
"match": {
"result.id": "2erfc096-3db0-4817-88fc-69db286e95b8"
},
"query": {
"nested": {
"path": "flights"
}
}
}
}
我的数据结构的图像
解决方案
进行_id
查询 - 不需要嵌套查询(如果格式错误):
{
"query": {
"terms": {
"_id": [
"2erfc096-3db0-4817-88fc-69db286e95b8"
]
}
}
}
或者
{
"query": {
"ids": {
"values": [
"2erfc096-3db0-4817-88fc-69db286e95b8"
]
}
}
}
提示:切勿在在线论坛中共享公共集群 IP。
推荐阅读
- python - 无法可靠地验证签名的消息
- docker - 在 ubuntu docker 映像中包含手册页?
- java - Saving data to a file doesn't behave as expected
- netlogo - How can I solve the error (you can not use my_ area in a patch context, it is a turtle-only)?
- django - Django,用公共部分分开设置文件
- apache-kafka - Kafka - 不同的配置设置
- python - 读取多个数据集
- amazon-web-services - S3 如何使公共 URL 唯一
- python - 如何将文本变成字典列表
- python - 尝试绘图时在赋值之前引用的局部变量