Elasticsearch-2.4.x > Mapping > Meta-fields > _field_names
程序员文章站
2022-07-14 20:57:51
...
_field_names field
_field_names字段索引文档中包含除null之外的任何值的每个字段的名称,该字段用于exists和missing查询使用,用于查找对指定字段具有或没有任何non-null值的文档.
在查询,聚合和脚本中可以访问_field_name字段的值:
# Example documents
PUT my_index/my_type/1
{
"title": "This is a document"
}
PUT my_index/my_type/1
{
"title": "This is another document",
"body": "This document has a body"
}
GET my_index/_search
{
"query": {
"terms": {
"_field_names": [ "title" ] (1)
}
},
"aggs": {
"Field names": {
"terms": {
"field": "_field_names", (2)
"size": 10
}
}
},
"script_fields": {
"Field names": {
"script": "doc['_field_names']" (3)
}
}
}
(1) 在_field_names字段上查询
(2) 在_field_names字段上聚合
(3) 在脚本中访问_field_names字段
上一篇: OpenGL与3D开发-旋转光照透明