在进行搜索时,Elasticsearch 返回一个包含各种元信息的数据结构。
实际结果集包含在从数据库返回的 JSON 结果中的“命中”字段中。
Elasticsearch 是否有可能只返回所需的数据(然后“命中”字段的内容)而不嵌入所有其他元数据中?
我知道我可以将结果解析为 JSON 并提取它,但我不希望复杂性、麻烦和性能受到影响。
谢谢!
下面是 Elasticsearch 返回的数据结构示例。
{
"_shards":{
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits":{
"total" : 1,
"hits" : [
{
"_index" : "twitter",
"_type" : "tweet",
"_id" : "1",
"_source" : {
"user" : "kimchy",
"postDate" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}
}
]
}
}