文档标识相关元数据字段
_index
- 当执行多索引查询时,可能需要添加特定的一些与文档有关联的索引的子句。
- _index 字段可以用在 term、terms 查询,聚合(aggregations)操作,脚本(script)操作以及用来排序(sort)。
GET index_1,index_2/_search { "query": { "terms": { "_index": ["index_1", "index_2"] } }, "aggs": { "indices": { "terms": { "field": "_index", "size": 10 } } }, "sort": [ { "_index": { "order": "asc" } } ], "script_fields": { "index_name": { "script": "doc['_index']" } } }