DevOps Classroom Series – 16/Apr/2021

Fix for kibana server not ready yet

  • Change the following in the /etc/elasticsearch/elasticsearch.yml Preview
  • Note: add the private ip of your elastic search server in the above highlighted section and restart elastic search and kibana Preview

Elastic Search

  • Elastic search plays the central role of search and analytics engine
  • Elastic search is built on Apache Lucene Refer Here
  • Benifits of Elastic Search
    • Schemaless and document oriented:
      • Elastic search doesn’t impose a strict structure on your & you can store any json documents
      • For learning about json Refer Here
      • Example documents
      {
          "name": "Ram",
          "address": " Near mythrivanam, Hyderabad",
          "courses": ["DevOps"]
      }
      
      {
          "name": "Robert",
          "email": "robertatqt@gmail.com"
      }
      
    • Searching Capability:
      • The core strength of Elastic search lies in its text searching capabilities. This also implements Full text search
    • Analytics:
      • Elastic search supports a wide variety of aggregations for analytics. These aggregations are quite powerfull and can be applied for various data types
    • Rich Client library support and the REST API
      • Elastic search has very rich client library support to make it accesible to many programming languages (Java, C#, Python, JavaScript, PHP, Ruby)
      • Elastic search has a Very RICH REST API (Which works on http)
    • Easy to operate and Easy to scale:
      • Elastic search can run on single node and easily scale to hundreds of nodes
    • Ligthning Fast
    • Fault-tolerant

Setting up kibana

Preview Preview Preview

Core Concepts of Elastic Search

  • Following are the core concepts of Elastic Search
    • Indexes
    • Types
    • Documents
    • Clusters
    • Nodes
    • Shards & replicas
    • Mappings & Types
    • Inverted Indexes
  • Example: Add the following using kibana console
PUT /library/_doc/1
{
    "title": "Mind Hacking, Unfck Yourself, Rich Dad Poor Dad, Smarter Faster Better 4 Books Collection Set",
    "ISBN-10": "1612680178",
    "Authors": [
        "Sir John Hargrave", "Gary John Bishop", "Charles Duhigg",  "Robert T. Kiyosaki"
    ],
    "Edition": 2,
    "Binding": "Paperback",
    "List Price": "0.17$",
    "Published": "January 2020"

}

Preview Preview

  • Elastic search can also be interacted using curl Preview

Indexes

  • An index is a container that stores and manages documents of single type in elastic search Preview
  • The concept of index in Elastic search is roughly analogues to the database schema in relational database. Going by this analogy, a type in Elasticsearch is equivalent to table and document is equivalent to record in the table.

Types

  • In our example of library, the document that was indexed was of library type. Each document stored in the library type represent one book
  • Typically documents with mostly common set of fields are grouped under one type
PUT /library/_doc/1
{
    "title": "Mind Hacking, Unfck Yourself, Rich Dad Poor Dad, Smarter Faster Better 4 Books Collection Set",
    "ISBN-10": "1612680178",
    "Authors": [
        "Sir John Hargrave", "Gary John Bishop", "Charles Duhigg",  "Robert T. Kiyosaki"
    ],
    "Edition": 2,
    "Binding": "Paperback",
    "List Price": "0.17$",
    "Published": "January 2020"

}

PUT /library/_doc/2
{
    "title": "Who Moved My Cheese",
    "ISBN-13": "9780399144462",
    "Author": "Johnson, Spencer",
    "Edition": 1,
    "Binding": "HardCover",
    "Published": "September 1998"

}
  • Next Steps:
    • Documents

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin