MapperParsingException在django

MapperParsingException在django

本文介绍了MapperParsingException在django-haystack中使用elasticsearch做rebuild_index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



每次尝试执行 python manage.py rebuild_index 时,在弹性搜索中遇到错误。这是错误:

 
MapperParsingException [根映射定义具有不受支持的参数:[_boost:{null_value = 1.0,name = boost}]]
在org.elasticsearch.index.mapper.DocumentMapperParser.checkNoRemainingFields(DocumentMapperParser.java:171)
在org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:159)
在org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:99)
在org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:498)
在org.elasticsearch .cluster.metadata.MetaDataMappingService $ PutMappingExecutor.applyRequest(MetaDataMappingService.java:257)
在org.elasticsearch.cluster.metadata.MetaDataMappingService $ PutMappingExecutor.execute(MetaDataMappingService.java:230)
在org.elasticsearch .cluster.service.InternalClusterService.runTasksForExecutor(InternalClusterService.java:468)
在org.elasticsearch.cluster.service.InternalClusterService $ UpdateTask.run(InternalClusterService.java:772)
在org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor $ TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEthreadPoolExecutor.java:231)
在org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor $ TieBreakingPrioritizedRunnable.run(PrioritizedEthreadPoolExecutor.java:194)
在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)
在java.lang.Thread.run(Thread.java:745)

这是我的配置:

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

HAYSTACK_SIGNAL_PROCESSOR ='haystack.signals.RealtimeSignalProcessor'

HAYSTACK_SEARCH_RESULTS_PER_PAGE = 40


解决方案

有一个相关的 django-haystack issue以删除在 ElasticSearch > = 2:中不再支持的 boost p>





在此更改之前, django-haystack ElasticSearch 后端的映射中使用 _boost 参数。改变主要分支。您现在可以执行以下操作:




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

      pip install -e git + https://github.com/toastdriven/django- haystack.git@master#egg=django-haystack 


  • 降级 ElasticSearch 到升级到最新的稳定版本之前,我认为这是




另外,这里是相关的讨论:




  • 中创建为字符串而不是geo_point


I'm using java 1.7.0_95, Django 1.8.4, Python 3.4.0, Django Rest Framework 3.1.3, ElasticSearch 2.3.1, pyelasticsearch 1.4 and Django Haystack 2.4.1

I'm experiencing an error in elasticsearch every time I try to do python manage.py rebuild_index. This is the error:

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)

Here is my configuration:

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
解决方案

There is a relevant django-haystack issue to remove the boost parameter which is no longer supported in ElasticSearch >= 2:

Before that change, django-haystack was using the _boost parameter in the mapping for the ElasticSearch backend. The change was made to the master branch. You can do things at this moment:

  • install the development version of django-haystack directly from github:

    pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack
    

  • downgrade ElasticSearch to the latest stable version before the upgrade to the 2nd, I think it is 1.7.3

Also, here is the relevant discussion:

这篇关于MapperParsingException在django-haystack中使用elasticsearch做rebuild_index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 10:07