Pack Hosting Panel


What is and how to use Elasticsearch.

Elasticsearch is developerd specificly with search and layered navigation in mind. Because of this Elasticsearch is much more suitable for e-commerce sites navigation and search features. Traditional solutions usually use MySQL, this results in a much bigger impact on the server load and negative performance of the application.

Elasticsearch is used using the Hipex CLI docker commands. For the rest of this tutorial we assume you are familiar with the docker basics.

Service configuratie

First we configure the service using a docker-compose.yml. In this file the elasticsearch version and port is defined. In these examples version 7.8 and port 19200 is used.

We recommend using a seperate folder for your elasticsearch instance so your configuration file would end up in: ~/elasticsearch/docker-compose.yml.

version: "3.2"

        image: elasticsearch:7.8.0
        restart: "always"
            discovery.type: "single-node"
        - "19200:9200"

Now the service can be started using docker:compose:up.

cd ~/elasticsearch/
hipex docker:compose:up --detach

Port bind error

When receiving a Bind for failed: port is already allocated error. The configured port 19200 is already in use and another port must be configured.


Now you can test your elasticsearch instance on port 19200.

curl localhost:19200

  "name" : "512decbc664a",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "hZ1_YRATQdOOw1tIz4nn2Q",
  "version" : {
    "number" : "7.8.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
    "build_date" : "2020-06-14T19:35:50.234439Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  "tagline" : "You Know, for Search"


When you need plugins like analysis-icu or analysis-phonetic for example the suggested way to do this is to create your own docker image like this:

FROM elasticsearch:6.8.0

RUN elasticsearch-plugin install -b analysis-icu
RUN elasticsearch-plugin install -b analysis-phonetic

If building your own docker image is not an option you can overwrite the default startup command to install them at startup.

version: "3.2"
        image: elasticsearch:6.5.0
        restart: "always"
            discovery.type: "single-node"
        command: bash -c "elasticsearch-plugin list | grep analysis-icu || elasticsearch-plugin install -b analysis-icu && elasticsearch-plugin list | grep analysis-phonetic || elasticsearch-plugin install -b analysis-phonetic && docker-entrypoint.sh"
        - "19201:9200"

The elasticsearch-plugin list | grep analysis-icu || elasticsearch-plugin install -b analysis-icu part will install the analysis-icu plugin if not installed. And we end with the default entrypoint docker-entrypoint.sh.