简体   繁体   中英

ElasticSearch ImportError: cannot import name 'Mapping' from 'elasticsearch.compat'

I get this import error when trying to run

from elasticsearch_dsl import Search, A

Full traceback

ImportError: cannot import name 'Mapping' from 'elasticsearch.compat' (C:\Users\SANA\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\elasticsearch\compat.py)

elasticsearch version: 7.13.3 elasticsearch-dsl version: 7.4.0

I have tried:

from collections.abc import Mapping

And can't seem to google my way to an answer

You must have installed elasticsearch_dsl. Install elasticsearch-dsl.

Try doing :

pip uninstall elasticsearch_dsl
pip install elasticsearch-dsl 

this should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM