How to set the http.max_content_length value for ElasticSearch container using docker container?

Viewed 1211

I am running ElasticSearch instance on my Ubuntu server using docker container. during a large insert-or-update request I get the following exception.

OriginalException: Elasticsearch.Net.ElasticsearchClientException: Request failed to execute. Call: Status code 413 from: POST /_bulk?pretty=true&error_trace=true

It sounds like I need to increase the http.max_content_length content from the default 100mb.

I bring up my docker instance using the following docker-compose

version: '3.4'
services:
  # Nginx proxy
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: nginx-proxy
    ports:
      - 80:80
      - 443:443
    restart: always
    networks:
      - nginx-proxy
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /etc/nginx/vhost.d:/etc/nginx/vhost.d:ro
      - /etc/certificates:/etc/nginx/certs

  # ElasticSearch instance
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
    container_name: es01
    environment:
      - VIRTUAL_HOST=my.elastic-domain.com
      - VIRTUAL_PORT=9200
      - ELASTIC_PASSWORD=mypassword
      - xpack.security.enabled=true
      - discovery.type=single-node
      - http.max_content_length=3000mb
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    expose:
      - 9200
    networks:
      - nginx-proxy
    depends_on:
      - nginx-proxy
volumes:
  data01:
    driver: local
networks:
  nginx-proxy:
  default:
    external:
      name: nginx-proxy

As you can see, I tried to increase the value by setting an environment variable http.max_content_length=3000mb

Also, in Nginx proxy, I set the client_max_body_size 0; to ensure the proxy allow unlimited size.

How to set the http.max_content_length value for ElasticSearch container using docker container?

0 Answers
Related