我在我的项目中使用弹性搜索。出于很多原因,我必须通过URI调用Elastic。像: “http://localhost:9200//demo/localetranslatemodel/_search?default_operator=AND&q=localeId%3Adaefa52a-cada-4370-9ae5-6bcfb50a9cf8+name%3AlblCommon_PartCost”弹性搜索uri调用返回一个字段
,这回:
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 8.272978,
"hits": [
{
"_index": "demo",
"_type": "localetranslatemodel",
"_id": "31bb0b3f-ace5-4007-b619-009f3e76bafc",
"_score": 8.272978,
"_source": {
"translate": "Part cost",
"localeId": "daefa52a-cada-4370-9ae5-6bcfb50a9cf8",
"name": "lblCommon_PartCost",
"id": "31bb0b3f-ace5-4007-b619-009f3e76bafc"
}
}
]
}
}
所以我的问题是:我只能返回“翻译:‘部分成本部分成本‘’或者说,对我来说非常好,唯一的?’ ? 我使用的HttpClient用于调用API,在ASP .NET项目。 非常感谢你的有用的答案,我想了一个星期做
所有的解决方案是为我好如果我问一些不可能的事情(像只返回_source)
哦,谢谢的,现在你我回: { “命中”:{ “点击”:[ { “_source”:{ “翻译”: “部分费用” } } ] } } 但我显然不能只返回“零件成本”权利?我的意思是只有价值 – blackstar012
我不这么认为。 – dadoonet