Basic Elasticsearch
Create index
Insert one row
POST student/_doc/1
{
"fullname": "Phan Nhật Nam",
"score": 9.2
}
Insert Bulk
POST student/_bulk
{ "index": { "_id": 2 } }
{ "fullname": "Vương Mộng Long", "score": 8.4 }
{ "index": { "_id": 3 } }
{ "fullname": "Huy Văn Trương", "score": 7.5 }
{ "index": { "_id": 4 } }
{ "fullname": "Trang Y Hạ", "score": 8.2 }
Query
Select one
GET student/_doc/1
Select All
GET student/_search
{
"query": {
"match_all": {}
}
}
Select with filter
GET student/_search?filter_path=hits.hits
{
"query": {
"match_all": {}
}
}