Getting 'error creating mapping' while using elasticsearch 5.6 with nodejs application

189 Views Asked by At

I am trying to deploy nodejs application on docker which uses elasticsearch 5.6 along with mongoosastic. I ran elasticsearch server first and then application server. Although, while starting app server it fails to map throwing :

error creating mapping
StatusCodeError: Request Timeout after 30000ms
    at /app/node_modules/elasticsearch/src/lib/transport.js:354:15
    at Timeout.<anonymous> (/app/node_modules/elasticsearch/src/lib/transport.js:383:7)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {
  status: 408,
  displayName: 'RequestTimeout',
  message: 'Request Timeout after 30000ms'
}

Run following commands to replicate issue:

git clone https://github.com/dipaksingbhukwal/easybuy.git
sudo apt-get install openjdk-8-jre
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.16.deb
sudo dpkg -i elasticsearch-5.6.16.deb
sudo /etc/init.d/elasticsearch start
docker build -t easybuy .
docker run -p 8000:8000 easybuy
  • Used Dockerfile
FROM node
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY . /app/
EXPOSE 8000
CMD node server.js

  • Used mongoosastic plugin:
ProductSchema.plugin(mongoosastic, {
  hosts: ['localhost:9200', 'anotherhost:9200']
});
0

There are 0 best solutions below