How to add documents to index in elasticsearch

  • برای این منظور در داخل Kibana به شکل زیر عمل می‌کنیم.
POST /homayouni_index/default
{
 "first name": "Iman",
 "last name": "Homayouni",
 "email": {
  "server": "gmail.com",
  "address": "homayouni@gmail.com"
 }
}


{
 "_index" : "homayouni_index",
 "_type" : "default",
 "_id" : "gXW--XoB2HniGXspHsqN",
 "_version" : 1,
 "result" : "created",
  "_shards" : {
  "total" : 2,
  "successful" : 1,
  "failed" : 0
 },
 "_seq_no" : 0,
 "_primary_term" : 1
}
  • می‌توان یک ID مشخص برای Document در نظر گرفت. برای این منظور به صورت زیر عمل می‌کنیم.
POST /homayouni_index/default/iman23
{
 "first name": "Iman",
 "last name": "Homayouni",
 "email": {
  "server": "gmail.com",
  "address": "homayouni@gmail.com"
 }
}


{
 "_index" : "homayouni_index",
 "_type" : "default",
 "_id" : "iman23",
 "_version" : 1,
 "result" : "created",
 "_shards" : {
  "total" : 2,
  "successful" : 1,
  "failed" : 0
 },
 "_seq_no" : 1,
 "_primary_term" : 1
}

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *