es一些常用的http接口命令

查询索引下所有的数据


curl -XPOST 'http://localhost:9210/index-person/person/_search?pretty' -d '
{
  "query": { "match_all": {} },
  "size": 1
}'

根据搜索条件查询数据

curl -XPOST 'http://localhost:9210/index-room/room/_search?pretty' -d '
{
  "query": {
        "bool": {
            "must": [
                {
                    "term": {
                        "person_id": "20181114"
                    }
                }
            ]
        }
  },
  "size": 10
}'

根据ES索引主键查询数据

curl -XGET 'http://localhost:9200/index-room/room/AWOM750VHemYGdvWMQRD?pretty' -d '
{}'

根据ES索引主键修改数据

curl -XPUT 'http://localhost:9210/index-room/room/AWOM750VHemYGdvWMQRD' -d '
{
    "room_id": "20181115", 
    "person_name": "刘明"
}'

查询并删除数据

curl -XDELETE 'http://localhost:9210/index-room/room/_query' -d '
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "person_id": "20181114"
          }
        }
      ]
    }
  }
}'

你可能感兴趣的:(Elasticsearch)