elasticsearch (databases/elasticsearch) Updated: 2 weeks, 2 days ago Add to my watchlist

Free and Open Source, Distributed, RESTful Search Engine

Elasticsearch is a distributed search and analytics engine, scalable data store and vector database optimized for speed and relevance on production-scale workloads. Elasticsearch is the foundation of Elastic’s open Stack platform. Search in near real-time over massive datasets, perform vector searches, integrate with generative AI applications, and much more.

Version: 9.5.6 License: AGPL-3 GitHub
Maintainers gerardsoleca
Categories databases java
Homepage https://www.elastic.co/
Platforms {darwin any}
Variants -

"elasticsearch" depends on

lib (1)
build (7)

Ports that depend on "elasticsearch"



Port notes

Elasticsearch 9.5.6 runs on Java 21, which is installed as a dependency.

Configuration lives in ${prefix}/etc/elasticsearch, data in ${prefix}/var/elasticsearch and logs in ${prefix}/var/log/elasticsearch.
After editing any configuration file, restart the service:

sudo port reload elasticsearch

SECURITY
This port ships with security turned off (xpack.security.enabled: false in ${prefix}/etc/elasticsearch/elasticsearch.yml), and Elasticsearch listens on localhost only. Requests need no credentials:

curl "http://localhost:9200?pretty"

Do not change network.host to a non-loopback address while security is off, because anyone who can reach the port could read and delete your data. To turn security on, delete that line from elasticsearch.yml, restart, and set a password for the built-in elastic user:

sudo -u elasticsearch ${prefix}/bin/elasticsearch-reset-password -u elastic -i

After that, requests need credentials (curl -u elastic ...).

MEMORY (JVM OPTIONS)
By default Elasticsearch sizes its own heap, up to about half of the machine's memory. To set a fixed size, create a file ending in .options in ${prefix}/etc/elasticsearch/jvm.options.d, for example:

sudo mkdir -p ${prefix}/etc/elasticsearch/jvm.options.d
printf -- '-Xms1g\n-Xmx1g\n' | sudo tee ${prefix}/etc/elasticsearch/jvm.options.d/heap.options

Keep -Xms and -Xmx equal, then restart the service. Prefer files in jvm.options.d over editing ${prefix}/etc/elasticsearch/jvm.options, so your settings are not overwritten when the port is upgraded.

To interact with Elasticsearch, start with commands like:

# default Elasticsearch response
curl -XGET "http://localhost:9200?pretty"

# create and configure a new index
curl -XPUT "http://localhost:9200/my_first_index" \
-H 'Content-Type: application/json' -d'
{
"settings" : {
"index" : {
"number_of_shards" : 5,
"number_of_replicas" : 2
}
}
}
'

# examine cluster health, shard disk usage and status
curl -XGET "http://localhost:9200/_cluster/health?pretty"
curl -XGET "http://localhost:9200/_cat/shards?v"

# irreversibly delete all data in /my_first_index
curl -XDELETE "http://localhost:9200/my_first_index"

Each Elasticsearch shard is a Lucene index; aim for 10-50 GB per shard. A startup item has been generated that will aid in starting elasticsearch with launchd. It is disabled by default. Execute the following command to start it, and to cause it to launch at startup:

sudo port load elasticsearch


Port Health:

Loading Port Health

Installations (30 days)

0

Requested Installations (30 days)

0

Livecheck results

elasticsearch seems to have been updated (port version: 9.5.6, new version: 9.5.7)

livecheck ran: 5 hours ago