- Login into your sandbox using SSH
- Update package list:
sudo apt-get update
- Install Java Runtime Environment:
sudo apt-get install default-jre -y
- Download and install Public Signing Key:
curl https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- Add repository definition:
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" \ | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
- Install Elastic Search:
sudo apt-get update && sudo apt-get install elasticsearch
- Start Elastic Search service:
sudo systemctl start elasticsearch
- We will be using 'curl' to troubleshoot the setup and to run our first queries before we install and configure Kibana
- Give it a moment to finish the initialization and verify it is running:
curl localhost:9200
- Expected response:
{ "name" : "ip-172-31-2-16", "cluster_name" : "elasticsearch", "cluster_uuid" : "ZH5wkpEESPqf8YwKWajRQA", "version" : { "number" : "7.14.0", "build_flavor" : "default", "build_type" : "deb", "build_hash" : "dd5a0a2acaa2045ff9624f3729fc8a6f40835aa1", "build_date" : "2021-07-29T20:49:32.864135063Z", "build_snapshot" : false, "lucene_version" : "8.9.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }
```
- Posting the first document:
curl -XPOST 'localhost:9200/orders/_doc/1?pretty=true' \ -H 'content-type: application/json' \ -d '{ "id": "1", "placedOn": "2016-10-17T13:03:30.830Z", "status": "shipped" }'
- Expected Response:
{ "_index" : "orders", "_type" : "_doc", "_id" : "1", "_version" : 1, "result" : "created", "_shards" : { "total" : 2, "successful" : 1, "failed" : 0 }, "_seq_no" : 0, "_primary_term" : 1 }
_seq_no
: unique sequence of the indexing operation_primary_term
: shard id where primary copy stored- First query:
curl 'localhost:9200/orders/_doc/_search?pretty=true&q=id:1'
- Where are: doc id, document data, index name, type name, and search score?
- Next time you can run the setup script at once:
curl https://gist.githubusercontent.com/vkhazin/6b0e44387368439af8e1750a1a0fa008/raw/02bbac1f7bf0c76e3dd49284da28f253f8ad5c73/Install%2520ElasticSearch%2520v7%2520on%2520Ubuntu%252018.04 | bash -