LinuxCommandLibrary

opensearch

TLDR

Start OpenSearch

$ opensearch
copy
Start with specific config
$ opensearch -E path.data=[/data] -E path.logs=[/logs]
copy
Run in foreground
$ opensearch -d
copy
Check cluster health
$ curl -XGET "http://localhost:9200/_cluster/health?pretty"
copy
Index a document
$ curl -XPOST "http://localhost:9200/[index]/_doc" -H 'Content-Type: application/json' -d '{"field":"value"}'
copy

SYNOPSIS

opensearch [options]

DESCRIPTION

OpenSearch is an open-source search and analytics engine derived from Elasticsearch 7.10.2. It provides full-text search, logging, and analytics capabilities.
OpenSearch includes OpenSearch Dashboards (forked from Kibana) for visualization.

PARAMETERS

-d

Run as daemon.
-p file
PID file path.
-E setting=value
Configuration setting.
-q, --quiet
Quiet mode.
-v, --verbose
Verbose mode.

REST API

$ # Create index
curl -XPUT "localhost:9200/myindex"

# Search
curl -XGET "localhost:9200/myindex/_search?q=field:value"

# Delete index
curl -XDELETE "localhost:9200/myindex"
copy

CONFIGURATION

$ /etc/opensearch/opensearch.yml
/etc/opensearch/jvm.options
copy

CAVEATS

Requires Java. Memory-intensive; configure heap size. Security plugin enabled by default.

HISTORY

OpenSearch was created by Amazon Web Services in 2021 as an open-source fork of Elasticsearch after Elastic changed its license.

SEE ALSO

Copied to clipboard