Hi All,
I am using Elasticsearch with Python using Docker on the MacBook Pro and getting the following error. The index is created but still getting the exception.
Print Logs:
Creating Elastic Search connection.
Elastic Search connection created.
Creating index product_index_202402250939
Elasticsearch API hit by Python
HEAD http://python_elasticsearch:9200/index_name [status:404 duration:0.012s]
PUT http://python_elasticsearch:9200/product_index_202402250939 [status:200 duration:0.134s]
Exception: The client noticed that the server is not Elasticsearch and we do not support this unknown product
docker-compose.yml
python_elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
container_name: python_elasticsearch
environment:
- node.name=python_elasticsearch
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=python_elasticsearch
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/Users/jeet/docker/es_data
ports:
- "9500:9200"
Environment details:
Python 3.12.2
Docker image: docker.elastic.co/elasticsearch/elasticsearch:7.11.0
Python code:
Connect to Elasticsearch:
ElasticConnect.es = Elasticsearch([
{'host': 'python_elasticsearch', 'port': 9200, 'scheme': 'http'}
]);
Create Index:
ElasticConnect.es.indices.create(index=index_name, body=mapping)
Please help me.
What is wrong here.