本文档为您介绍使用阿里云Elasticsearch(简称ES)服务搜索文档的方法。

通过Kibana控制台访问阿里云ES,执行以下命令搜索文档。
GET /my_index/_search?q=title:T*
以上命令搜索title字段包含T的所有文档,执行成功后的结果如下:
{
  "took" : 118,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 2,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "my_index",
        "_type" : "my_type",
        "_id" : "2",
        "_score" : 1.0,
        "_source" : {
          "title" : "Two",
          "tags" : [
            "ruby"
          ],
          "post_date" : "2009-11-15T14:00:00"
        }
      },
      {
        "_index" : "my_index",
        "_type" : "my_type",
        "_id" : "3",
        "_score" : 1.0,
        "_source" : {
          "title" : "Three",
          "tags" : [
            "ruby"
          ],
          "post_date" : "2009-11-15T15:00:00"
        }
      }
    ]
  }
}

参考官方文档:URI Search