elasticSearch 基本http操作

2020-10-23  本文已影响0人  摩V羯座

create index

Method.put address/indexName

delete index

Method.delete address/indexName

create _mapping

Method.post address/indexName/typeName/_mapping

{
  "properties": {
    "testid": {
      "type": "keyword"
    },
    "stu_code": {
      "type": "keyword"
    },
    "stu_name": {
      "type": "keyword"
    },
    "stu_age": {
      "type": "keyword"
    },
    "stu_date": {
      "type": "text"
    }
  }
}

get mapping

Method.get address/index/_mapping

create or update doc

Method.post address/indexName/typeName/docid

{ "testid":"2", "stu_code":"1A0001", "stu_name":"testName", "stu_age":"30", "stu_date":"1528887157215"}

query doc

Method.post address/indexName/_search

{
    "query":{
        "match_all":{}
    }
}

delete doc

Method.post address/indexName/type/_delete_by_query

{
    "query":{
        "match_all":{}
    }
}
上一篇下一篇

猜你喜欢

热点阅读