Running Elasticsearch locally with multiple nodes

mikko.ropanen
mikko.ropanen Spryker Solution Partner Posts: 28 ✨ - Novice

Hi, we ran into the "inconsistent scoring" issue https://www.elastic.co/guide/en/elasticsearch/reference/7.17/consistent-scoring.html in our production environment. While the fix was pretty simple (change search_type to dfs_query_then_fetch), I currently don't have a way of verifying it since production AWS is the only place that uses more than one ES node.

Is there a way to run Elasticsearch locally with more than one node?

Best Answer

  • Oleksandr Peresypkin
    Oleksandr Peresypkin Lead Demo Engineering Sprykee Posts: 24 ✨ - Novice
    Answer ✓

    You could try the following approach:

    • Stop the project docker/sdk stop
    • Comment out the section in the deploy file deploy.dev.yml
    #    search:
    #        engine: elastic
    #        version: '7.10'
    #        endpoints:
    #            localhost:9200:
    #                protocol: tcp
    
    • Add the following environment variables to the section
    image:
        …
        environment:
            …
            SPRYKER_SEARCH_HOST: host.docker.internal
            SPRYKER_SEARCH_PORT: 9200
    

    host.docker.internal in the case of using Docker Desktop

Answers

  • Oleksandr Peresypkin
    Oleksandr Peresypkin Lead Demo Engineering Sprykee Posts: 24 ✨ - Novice
    Answer ✓

    You could try the following approach:

    • Stop the project docker/sdk stop
    • Comment out the section in the deploy file deploy.dev.yml
    #    search:
    #        engine: elastic
    #        version: '7.10'
    #        endpoints:
    #            localhost:9200:
    #                protocol: tcp
    
    • Add the following environment variables to the section
    image:
        …
        environment:
            …
            SPRYKER_SEARCH_HOST: host.docker.internal
            SPRYKER_SEARCH_PORT: 9200
    

    host.docker.internal in the case of using Docker Desktop

  • mikko.ropanen
    mikko.ropanen Spryker Solution Partner Posts: 28 ✨ - Novice

    The above solution works nicely 👍️

    If anyone else is not using Docker Desktop and gets fixated on the "host.docker.internal" part like I did:
    you can just use "es01" (the name of the first Elasticsearch node)