Skip to content

Latest commit

 

History

History
95 lines (90 loc) · 2.69 KB

OneNodeSetupEx.md

File metadata and controls

95 lines (90 loc) · 2.69 KB

One Node Setup Exercise

  1. Login into your sandbox using SSH
  2. Update package list:
    sudo apt-get update
    
  3. Install Java Runtime Environment:
    sudo apt-get install default-jre -y
    
  4. Download and install Public Signing Key:
    curl https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
    
  5. 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
    
  6. Install Elastic Search:
    sudo apt-get update && sudo apt-get install elasticsearch
    
  7. Start Elastic Search service:
    sudo systemctl start elasticsearch
    
  8. We will be using 'curl' to troubleshoot the setup and to run our first queries before we install and configure Kibana
  9. Give it a moment to finish the initialization and verify it is running:
    curl localhost:9200
    
  10. 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" }

```
  1. 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"
    }'
  2. 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
    }
  3. _seq_no: unique sequence of the indexing operation
  4. _primary_term: shard id where primary copy stored
  5. First query:
    curl 'localhost:9200/orders/_doc/_search?pretty=true&q=id:1'
    
  6. Where are: doc id, document data, index name, type name, and search score?
  7. 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 -