Running two Elasticsearch instances during the build

One of the best options to run two Elasticsearch instances on the same build container would be to follow the advice of this StackOverflow answer.

You could copy the elasticsearch init script and save the modified version as elasticsearch2 with all the necessary adjustments (port number, pidfile, etc), and check the script into your repo. During the build you would copy the config into the init.d directory with the following commands in your circle.yml, supposing that your modified config is stored as scripts/elasticsearch2 in your repo:

dependencies;
  pre:
    - sudo cp --preserve scripts/elasticsearch2 /etc/init.d/elasticsearch2
    - sudo chkconfig --add elasticsearch2
    - sudo service elasticsearch start
    - sudo service elasticsearch2 start