Skip to content

Instantly share code, notes, and snippets.

@omarsar
Created September 30, 2019 09:41
Show Gist options
  • Save omarsar/b602614c67ba8f864c909cd5697f41bf to your computer and use it in GitHub Desktop.
Save omarsar/b602614c67ba8f864c909cd5697f41bf to your computer and use it in GitHub Desktop.
milan-eng1-module1.md
GET _search
{
  "query": {
    "match_all": {}
  }
}


GET /

# Lab 3: CRUD Operations

PUT my_blogs/_doc/1
{
  "id": "1",
  "title": "Better query execution",
  "category": "Engineering",
  "date":"July 15, 2015",
  "author":{
    "first_name": "Adrian",
    "last_name": "Grand",
    "company": "Elastic"
  }
}

PUT my_blogs/_doc/2
{
  "id": "2",
  "title": "The Story of Sense",
  "date":"May 28, 2015",
  "author":{
    "first_name": "Boaz",
    "last_name": "Leskes"
  }
}


POST my_blogs/_doc/
{
  "id": "57",
  "title": "Phrase Queries: a world without Stopwords",
  "date":"March 7, 2016",
  "category": "Engineering",
  "author":{
    "first_name": "Gabriel",
    "last_name": "Moskovicz"
  }
}


GET my_blogs/_doc/1

DELETE my_blogs/_doc/1

GET my_blogs/_doc/1


POST my_blogs/_bulk
{"update": {"_id": 2}}
{"doc": {"category": "Engineering", "author.company":"Elastic"}}
{"index": {"_id": 3}}
{"title":"Using Elastic Graph","category":"Engineering","date":"May 25, 2016","author":{"first_name":"Mark","last_name":"Harwood","company":"Elastic"}}

GET my_blogs/_search

GET my_blogs/_mget
{
  "docs": [
    {"_id":2},
    {"_id":3}
  ]
}

DELETE my_blogs

# see all indices
GET _cat/indices

# search all documents in index
GET blogs/_search

# num of docs in index
GET blogs/_count


GET logs_server1,logs_server2,logs_server3/_count
GET logs_server*/_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment