弹性搜索 - 如何只返回数据,而不是元信息? [英] Elasticsearch - how to return only data, not meta information?
问题描述
当进行搜索时,Elasticsearch返回一个包含各种元信息的数据结构。
When doing a search, Elasticsearch returns a data structure that contains various meta information.
实际结果集包含在JSON结果中的命中字段中从数据库返回。
The actual result set is contained within a "hits" field within the JSON result returned from the database.
Elasticsearch是否可以只返回所需的数据(hits字段的内容),而不会嵌入到所有其他元数据中
Is it possible for Elasticsearch to return only the needed data (the contents of then "hits" field) without being embedded within all the other meta data?
我知道我可以将结果解析成JSON并解压缩,但我不希望复杂性,麻烦,性能下降。
I know I could parse the result into JSON and extract it, but I don't want the complexity, hassle, performance hit.
谢谢!
以下是Elasticsearch返回的数据结构示例。
Here is an example of the data structure that Elasticsearch returns.
{
"_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"
}
}
]
}
}
推荐答案
不,现在是不可能的。如果分析的性能和复杂性是主要问题,您可能需要考虑使用不同的客户端: java客户端或 Thrift插件,例如。
No, it's not possible at this moment. If performance and complexity of parsing are the main concerns, you might want to consider using different clients: java client or Thrift plugin, for example.
这篇关于弹性搜索 - 如何只返回数据,而不是元信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!