class

Testcontainers::ElasticsearchContainer

Inherits Testcontainers::DockerContainer < Reference < Object

ElasticsearchContainer provides a pre-configured container for Elasticsearch.

Example:

container = Testcontainers::ElasticsearchContainer.new
container.start

url = container.elasticsearch_url
# => "http://localhost:32768"

container.stop
container.remove

Constants

ES_DEFAULT_IMAGE = "elasticsearch:8.11.0"
ES_DEFAULT_PASSWORD = "test"
ES_DEFAULT_PORT = 9200

Constructors

new(image : String = ES_DEFAULT_IMAGE, password : String = ENV.fetch("ELASTIC_PASSWORD", ES_DEFAULT_PASSWORD))
Source

Instance methods

elasticsearch_url(protocol : String = "http") : String

Returns the Elasticsearch URL.

Source
password
Source
port
Source
start

Starts the container.

This will:

  1. Pull the image if not present
  2. Create the container
  3. Start the container
  4. Execute the wait strategy (if any)

Returns self for method chaining.

Source
with_password(password : String) : self
Source