DevOps Classroomnotes 15/Jul/2022

Index and Document

  • Index and Document
  • 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


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

Exercise:

  • Create an index with yourname
  • Check if the index exists or not
  • delete the index
  • 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"]
}
'

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%