Behebung von ElasticSearch 'Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true'
English
Deutsch
Problem:
Du möchtest ein Mapping in ElasticSearch erstellen, aber du siehst eine Fehlermeldung wie
es_mapping_error_output.txt
elasticsearch.exceptions.RequestError: RequestError(400, 'illegal_argument_exception', 'Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true.')Lösung
Wie bereits in der Fehlermeldung vorgeschlagen, setze den include_type_name-Parameter auf True.
Mit der Python-API ist dies so einfach wie das Hinzufügen von include_type_name=True zum put_mapping(...)-Aufruf:
es_put_mapping_fix.py
es.indices.put_mapping(index='my_index', body=my_mapping, doc_type='_doc', include_type_name=True)Falls du nun einen Fehler wie diesen siehst
es_put_mapping_typeerror.txt
TypeError: put_mapping() got an unexpected keyword argument 'include_type_name'musst du deine elasticsearch-Python-Bibliothek aktualisieren, z.B. mit
upgrade_elasticsearch_pip.sh
pip install -U elasticsearchCheck out similar posts by category:
Databases, ElasticSearch, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow