【发布时间】:2021-12-09 15:02:57
【问题描述】:
我尝试将 elasticsearch 的 json 结果减少到我建议获取的一列或多列。有什么办法吗?
当我使用以下命令时,我将结果嵌套到“_source”中:
{
"from": "0", "size":"2",
"_source":["id"],
"query": {
"match_all": {}
}
}
'
并且不需要我的用例。
我得到这个结果:
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "indexer_1",
"_type" : "type_indexer_1",
"_id" : "38142",
"_score" : 1.0,
"_source" : {
"id" : 38142
}
},
{
"_index" : "indexer_1",
"_type" : "type_indexer_1",
"_id" : "38147",
"_score" : 1.0,
"_source" : {
"id" : 38147
}
}
]
}
}
我想要什么:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"id" : 38142
},
{
"id" : 38147
}
]
}
}
我会喜欢这个 json 结果:
{
{
"id" : 38142
},
{
"id" : 38147
}
}
ES中有没有开箱即用的方法来减少结果集?
【问题讨论】:
标签: elasticsearch elasticsearch-dsl