使用elasticsearch在django-haystack中执行rebuild_index时的MapperParsingException

时间:2016-04-23 16:25:15

标签: python django elasticsearch django-haystack

我正在使用java 1.7.0_95Django 1.8.4Python 3.4.0Django Rest Framework 3.1.3ElasticSearch 2.3.1pyelasticsearch 1.4Django Haystack 2.4.1

每次尝试python manage.py rebuild_index时,我都会遇到弹性搜索中的错误。这是错误:

MapperParsingException[Root mapping definition has unsupported parameters:  [_boost : {null_value=1.0, name=boost}]]
        at org.elasticsearch.index.mapper.DocumentMapperParser.checkNoRemainingFields(DocumentMapperParser.java:171)
        at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:159)
        at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:99)
        at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:498)
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.applyRequest(MetaDataMappingService.java:257)
        at org.elasticsearch.cluster.metadata.MetaDataMappingService$PutMappingExecutor.execute(MetaDataMappingService.java:230)
        at org.elasticsearch.cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:468)
        at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:772)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:231)
        at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:194)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

这是我的配置:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
        'URL': 'http://127.0.0.1:9200/',
        'INDEX_NAME': 'haystack',
    },
}

HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'

HAYSTACK_SEARCH_RESULTS_PER_PAGE = 40

1 个答案:

答案 0 :(得分:4)

有一个相关的django-haystack问题需要删除boost> = 2中不再支持的ElasticSearch参数:

在更改之前,django-haystack_boost后端的映射中使用了ElasticSearch参数。对主分支进行了更改。你现在可以做的事情:

  • 直接从github安装django-haystack的开发版本:

    pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack
    
  • 在升级到第二版之前将ElasticSearch降级到最新的稳定版本,我认为是1.7.3

另外,以下是相关讨论: