Skip to content

Instantly share code, notes, and snippets.

@mosheka
Last active June 25, 2017 07:49
Show Gist options
  • Save mosheka/043ce9ca7e17e37b9fb585b500093fc1 to your computer and use it in GitHub Desktop.
Save mosheka/043ce9ca7e17e37b9fb585b500093fc1 to your computer and use it in GitHub Desktop.
Useful Elasticsearch and Logstash commands in Docker stack
#!/bin/bash
#map folder to logstash:
# > pipeline
# > input files
mkdir /tmp/input
rm -rf /tmp/input/*
mkdir /tmp/pipeline &&\
cd /tmp/pipeline &&\
wget -O logstash.conf logstash.csv.conf
docker-compose up
#Show the list of running docker containers
docker ps
#Show the list of current installed plugins
docker exec -it es_logstash_1 /usr/share/logstash/bin/logstash-plugin list
#Installing the base64 plugin
docker exec -it es_logstash_1 /usr/share/logstash/bin/logstash-plugin install logstash-filter-base64
#> Validating logstash-filter-base64
#> Installing logstash-filter-base64
#> Installation successful
cp /tmp/crawl_data.csv /tmp/input
#Get All indexes
curl 'elastic:changeme@localhost:9200/_cat/indices?v'
#Show the docs we entered
curl 'elastic:changeme@localhost:9200/_cat/indices?v'
#show the index
curl 'elastic:changeme@localhost:9200/csv'
#Delete the index
curl -XDELETE 'elastic:changeme@localhost:9200/csv'
#Create the index w/ the analyzers
curl -XPUT -H 'Content-Type: application/json' -d '{"settings": {"analysis": {"analyzer": {"my_english_analyzer": {"type": "standard","stopwords": "_english_", "char_filter":["html_strip"], "filter":["lowercase"]}}}}}' 'elastic:changeme@localhost:9200/csv'
#Show the results
curl 'elastic:changeme@localhost:9200/csv/_search?q=0&format=yaml'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment