Giter VIP home page Giter VIP logo

part-1-intro-to-elasticsearch-and-kibana's Introduction

Beginner's Crash Course to Elastic Stack Series

Part 1: Intro to Elasticsearch & Kibana

Welcome to the Beginner's Crash Course to Elastic Stack!

This repo contains all resources shared during workshop Part 1: Intro to Elasticsearch and Kibana.

By the end of this workshop, you will be able to:

  • understand a use case of Elasticsearch and Kibana
  • understand the basic architecture of Elasticsearch
  • perform CRUD(Create, Read, Update, and Delete) operations with Elasticsearch and Kibana

Resources

Beginner's Crash Course to Elastic Stack Table of Contents This workshop is a part of the Beginner's Crash Course to Elastic Stack series. Check out this table contents to access all the workshops in the series thus far. This table will continue to get updated as more workshops in the series are released!

Free Elastic Cloud Trial

Instructions on how to access Elasticsearch and Kibana on Elastic Cloud

Instructions for downloading Elasticsearch and Kibana

Presentation

Recording of the workshop

Blog Beginner's guide to Elasticsearch

Blog Beginner's guide to performing CRUD operations with Elasticsearch and Kibana

Elastic America Virtual Chapter Want to attend live workshops? Join the Elastic America Virtual Chapter to get the deets!

What's next? Eager to continue your learning after mastering the concept from this workshop? Move on to Part 2: Understanding the relevance of your search with Elasticsearch and Kibana here!

Getting information about cluster and nodes

Syntax:

GET _API/parameter

Get info about cluster health

GET _cluster/health

Expected response from Elasticsearch:

image

Get info about nodes in a cluster

GET _nodes/stats

Expected response from Elasticsearch:

image

Performing CRUD operations

C - Create

Create an index

Syntax:

PUT Name-of-the-Index

Example:

PUT favorite_candy

Expected response from Elasticsearch:

image

Index a document

When indexing a document, both HTTP verbs POST or PUT can be used.

  1. Use POST when you want Elasticsearch to autogenerate an id for your document.

Syntax:

POST Name-of-the-Index/_doc
{
  "field": "value"
}

Example:

POST favorite_candy/_doc
{
  "first_name": "Lisa",
  "candy": "Sour Skittles"
}

Expected response from Elasticsearch: image

  1. Use PUT when you want to assign a specific id to your document(i.e. if your document has a natural identifier - purchase order number, patient id, & etc). For more detailed explanation, check out this documentation from Elastic!

Syntax:

PUT Name-of-the-Index/_doc/id-you-want-to-assign-to-this-document
{
  "field": "value"
}

Example:

PUT favorite_candy/_doc/1
{
  "first_name": "John",
  "candy": "Starburst"
}

_create Endpoint

When you index a document using an id that already exists, the existing document is overwritten by the new document. If you do not want a existing document to be overwritten, you can use the _create endpoint!

With the _create Endpoint, no indexing will occur and you will get a 409 error message.

Syntax:

PUT Name-of-the-Index/_create/id-you-want-to-assign-to-this-document
{
  "field": "value"
}

Example:

PUT favorite_candy/_create/1
{
  "first_name": "Finn",
  "candy": "Jolly Ranchers"
}

Expected response from Elasticsearch:

image

R - READ

Read a document

Syntax:

GET Name-of-the-Index/_doc/id-of-the-document-you-want-to-retrieve

Example:

GET favorite_candy/_doc/1

Expected response from Elasticsearch:

image

U - UPDATE

Update a document

If you want to update fields in a document, use the following syntax:

POST Name-of-the-Index/_update/id-of-the-document-you-want-to-update
{
  "doc": {
    "field1": "value",
    "field2": "value",
  }
} 

Example:

POST favorite_candy/_update/1
{
  "doc": {
    "candy": "M&M's"
  }
}

Expected response from Elasticsearch:

image

D- DELETE

Delete a document

Syntax:

DELETE Name-of-the-Index/_doc/id-of-the-document-you-want-to-delete

Example:

DELETE favorite_candy/_doc/1

Expected response from Elasticsearch: image

Take Home Assignment

  1. Create an index called places.
  2. Pick five of the places you want to visit after the pandemic is over. For each place, index a document containing the name and the country.
  3. Read(GET) each document to check the content of the document.
  4. Update a field of a document.
  5. Read(GET) the updated document to ensure that the field has been updated.
  6. Delete a document of one place.
  7. Copy and paste the following request to return all documents from the places index. This is a great way to check whether all the CRUD operations you have performed thus far have worked!
GET places/_search
{
  "query": {
    "match_all": {}
  }
}

part-1-intro-to-elasticsearch-and-kibana's People

Contributors

lisahjung avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.