我在我的項目中使用彈性搜索。出於很多原因,我必須通過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