gpt4 book ai didi

elasticsearch - 震动-更改Elasticsearch响应的格式

转载 作者:行者123 更新时间:2023-12-03 01:45:26 26 4
gpt4 key购买 nike

这应该毫不费力,因为Jolt主要是为了转换ES和mongodb响应而构建的。但是我无法弄清楚

我想解析ES响应并仅打印所选字段。例如我想将响应转换为

{
"time" : 63,
"totalhits":100,
"0";{ response1.field1,response1.field2},
"1";{ response2.field1,response2.field2},
"2";{ response3.field1,response3.field2},
}


{
"took" : 63,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1000,
"max_score" : null,
"hits" : [ {
"_index" : "bank",
"_type" : "account",
"_id" : "0",
"sort": [0],
"_score" : null,
"_source" : {"account_number":0,"balance":16623,"firstname":"Bradshaw","lastname":"Mckenzie","age":29,"gender":"F","address":"244 Columbus Place","employer":"Euron","email":"bradshawmckenzie@euron.com","city":"Hobucken","state":"CO"}
}, {
"_index" : "bank",
"_type" : "account",
"_id" : "1",
"sort": [1],
"_score" : null,
"_source" : {"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
}, ...
]
}
}

我到目前为止得到的规格文件是
[
{
"operation": "shift",
"spec": {
"hits": {
"*": {
"*": "&"
}
}
}
}
]

最佳答案

弄清楚了。

[
{
"operation": "shift",
"spec": {
"took": "took",
"hits": {
"total": "total_hits",
"hits": {
"*": {
"_source": {
"country": "Response[&2].country",
"city": "Response[&2].city",
"year": "Response[&2].year"
}
}
}
}
}
}
]

关于elasticsearch - 震动-更改Elasticsearch响应的格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44423262/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com