DevOps Classroomnotes 15/Jul/2022

Index and Document

  • Index and Document
    Preview
  • The process of inserting data/documents is called as indexing
  • Lets refer the elastic search rest api’s Refer Here
  • Refer Here for index apis
  • Lets create curl request to create the index
ESPASS='nplUwdODeH4xtPfp=CT2'
SERVER_URL='https://20.198.70.188:9200'
# Checking if the index exists
curl -I -u elastic:$ESPASS "${SERVER_URL}/sample" --insecure
# we got 404 response => index not found

Preview
* Lets create one more index with
* name: sample2
* number of shards 1
* number of replicas 1
Preview

Exercise:

  • Create an index with yourname
  • Check if the index exists or not
  • delete the index
    Preview
  • The commands used are
curl -I -u elastic:$ESPASS "https://20.198.70.188:9200/khajaibrahim?pretty" --insecure
curl -X DELETE -u elastic:$ESPASS "https://20.198.70.188:9200/khajaibrahim?pretty" --insecure
curl -I -u elastic:$ESPASS "https://20.198.70.188:9200/khajaibrahim?pretty" --insecure
  • Now let me insert a document about Devops
{
    "name": "DevOps",
    "tools": ["Git", "Ansible", "Jenkins", "Docker", "K8s", "Terraform", "SRE"]
}
  • The curl request is
curl -X POST -u elastic:$ESPASS "https://20.198.70.188:9200/khajaibrahim/_doc?routing=kimchy&pretty" -H 'Content-Type: application/json' --insecure -d'
{
    "name": "DevOps",
    "tools": ["Git", "Ansible", "Jenkins", "Docker", "K8s", "Terraform", "SRE"]
}
'

Preview

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner