elasticsearch 中的 _meta 字段无法正常工作
_meta field in elasticsearch is not working as it is supposed to be
这是我的映射:
"mappings" : {
"mytype" : {
"_meta" : {
"abs_parent_id" : {"type" : "integer"}
},
"properties" : {
"title" : {"type" : "text"},
"body" : {"type" : "text"},
"tagnames" : {"type" : "text"},
"nodetype" : {"type" : "text"},
"author_id" : {"type" : "integer"},
"author_name" : {"type" : "text"},
}
}
}
我希望这是我这样做时的回应 http://localhost:9200/myindex/mytype/_search?pretty:
"hits" : [
{
"_index" : "myindex",
"_type" : "mytype",
"_id" : "1",
"_score" : 1.0,
"_meta" : {
"abs_parent_id" : null
},
"_source" : {
"body" : "<p>Some statement</p>",
"tagnames" : "tag",
"title" : "question",
"author_name" : "author",
"node_type" : "question",
"author_id" : 1000
}
},
但我得到的是这样的回应:
"hits" : [
{
"_index" : "myindex",
"_type" : "mytype",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"_meta" : {
"abs_parent_id" : null
},
"body" : "<p>Some statement</p>",
"tagnames" : "tag",
"title" : "question",
"author_name" : "author",
"node_type" : "question",
"author_id" : 1000
}
},
我需要在 _source 之外有 _meta 字段,这样我就可以在我的查询中禁用 _source,这将节省内存。谁能提出解决方案?
不是所有以下划线开头的字段都应该在 _source 之外吗?
旁注:我认为这无关紧要,但我正在使用 elasticsearch-py 完成所有这些工作。
这不是元字段的用途。 mapping 中配置的元字段不是搜索响应的一部分,它们仅包含索引元数据中的附加信息,仅此而已 - 与元字段相关的查询(甚至与您的数据)的交互为零.
您关于带下划线的字段的假设也是错误的。它们被视为常规字段。
这是我的映射:
"mappings" : {
"mytype" : {
"_meta" : {
"abs_parent_id" : {"type" : "integer"}
},
"properties" : {
"title" : {"type" : "text"},
"body" : {"type" : "text"},
"tagnames" : {"type" : "text"},
"nodetype" : {"type" : "text"},
"author_id" : {"type" : "integer"},
"author_name" : {"type" : "text"},
}
}
}
我希望这是我这样做时的回应 http://localhost:9200/myindex/mytype/_search?pretty:
"hits" : [
{
"_index" : "myindex",
"_type" : "mytype",
"_id" : "1",
"_score" : 1.0,
"_meta" : {
"abs_parent_id" : null
},
"_source" : {
"body" : "<p>Some statement</p>",
"tagnames" : "tag",
"title" : "question",
"author_name" : "author",
"node_type" : "question",
"author_id" : 1000
}
},
但我得到的是这样的回应:
"hits" : [
{
"_index" : "myindex",
"_type" : "mytype",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"_meta" : {
"abs_parent_id" : null
},
"body" : "<p>Some statement</p>",
"tagnames" : "tag",
"title" : "question",
"author_name" : "author",
"node_type" : "question",
"author_id" : 1000
}
},
我需要在 _source 之外有 _meta 字段,这样我就可以在我的查询中禁用 _source,这将节省内存。谁能提出解决方案?
不是所有以下划线开头的字段都应该在 _source 之外吗?
旁注:我认为这无关紧要,但我正在使用 elasticsearch-py 完成所有这些工作。
这不是元字段的用途。 mapping 中配置的元字段不是搜索响应的一部分,它们仅包含索引元数据中的附加信息,仅此而已 - 与元字段相关的查询(甚至与您的数据)的交互为零.
您关于带下划线的字段的假设也是错误的。它们被视为常规字段。