首页 > elasticsearch索引中设置mapping中类型的_source和_all为false后,是否就查不到数据了?

elasticsearch索引中设置mapping中类型的_source和_all为false后,是否就查不到数据了?

比如这样一个mapping的设置

mappings = {
    'testdata': {
        '_source': {'enabled': False},
        '_all': {'enabled': False},
        'properties': {
            'timestamp': {
                'type': 'date',
                'index': 'no',
                'store': False,
                'dynamic': 'strict',
                'doc_values': True,
                'fielddata': {
                    'format': 'doc_values'
                }
            },
            'vAppid': {
                'type': 'string',
                'index': 'no',
                'store': False,
                'dynamic': 'strict',
                'doc_values': True,
                'fielddata': {
                    'format': 'doc_values'
                }
            }
        }
    }
}

查询数据时没有查到数据是什么原因?
上面mappings的设置节选自 ElasticSearch 使用不同表结构存储时间序列数据的查询效率分析 ,
为什么他的文章里可以查到数据,而我却查不到?


source:false的时候es默认是不会存储数据的


DocValues 只在聚合查询的时候被Elasticsearch使用,在Fetch阶段是不会使用DocValues的。要么设置stored:true要么设置_source:true

【热门文章】
【热门文章】