Created
May 22, 2018 20:53
-
-
Save MatthewRiggott/d9228ead719a5756a935652ae5f9d304 to your computer and use it in GitHub Desktop.
Run Elastic Search in shell with verbose output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Elastic Search version 5.6 | |
# Credit to https://opensourceconnections.com/blog/2016/04/21/run-elasticsearch-in-your-shell/ | |
# This mostly worked, I had to remove the argument for default.path.home and prepend each arg with -E (ES version 5.0+ breaking change) | |
# | |
# Add the following to your path and load (for ubuntu, actual paths may vary) | |
# Elastic Search Settings -- | |
# ES_JAVA_OPTS="-Des.logger.level=INFO" | |
# LOG_DIR="/var/log/elasticsearch" | |
# DATA_DIR="/var/lib/elasticsearch" | |
# CONF_DIR="/etc/elasticsearch" | |
# ES_HOME="/usr/share/elasticsearch" | |
# | |
# Finally you should now be able to manually run ElasticSearch | |
sudo -u elasticsearch ES_JAVA_OPTS=$ES_JAVA_OPTS bash -x $ES_HOME/bin/elasticsearch --verbose -Edefault.path.logs=$LOG_DIR -Edefault.path.data=$DATA_DIR -Edefault.path.conf=$CONF_DIR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get detailed ES instance output | |
curl -XGET 'http://localhost:9200/_nodes?pretty' | |
# List all indexes | |
curl -X GET "localhost:9200/_cat/indices?v" | |
# Healthcheck | |
curl -X GET "localhost:9200/_cat/health?v" | |
# Create Document | |
curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d' | |
{ | |
"name": "John Doe" | |
} | |
' | |
# Query Document | |
curl -X GET "localhost:9200/customer/_doc/1?pretty" | |
# Delete Document | |
curl -X DELETE "localhost:9200/customer?pretty" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment