《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.2.Elasticsearch基础应用——3.4.2.3.Search通过Kibana(3) https://developer.aliyun.com/article/1231068
查询 my_goods_new 索引数据:
GET my_goods_new/_search/ { "took" : 5, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 4, "relation" : "eq" }, "max_score" : 1.0, "hits" : [ { "_index" : "my_goods_new", "_type" : "_doc", "_id" : "7", "_score" : 1.0, "_source" : { "goodsName" : "三星UA55RU7520JXXZ 52英寸 4K超高清", "skuCode" : "skuCode2", "brandName" : "三星", "closeUserCode" : [ "0" ], "channelType" : "cmccPlatform", "shopCode" : "sc00001", "publicPrice" : "8288.88", "groupPrice" : null, "boxPrice" : [ { "boxType" : "box1", "boxUserCode" : [ "htd002" ], "boxPriceDetail" : 4288.88 } ], "boostValue" : 1.2 } }, { "_index" : "my_goods_new", "_type" : "_doc", "_id" : "8", "_score" : 1.0, "_source" : { "goodsName" : "三星UA55RU7520JXXZ 52英寸 4K超高清", "skuCode" : "skuCode2", "brandName" : "三星", "closeUserCode" : [ "uc0022" ], "channelType" : "cloudPlatform", "shopCode" : "sc00001", "publicPrice" : "8288.88", "groupPrice" : null, "boxPrice" : [ { "boxType" : "box1", "boxUserCode" : [ "uc0022" ], "boxPriceDetail" : 4288.88 } ], "boostValue" : 1.2 } }, { "_index" : "my_goods_new", "_type" : "_doc", "_id" : "9", "_score" : 1.0, "_source" : { "goodsName" : "三星UA55RU7520JXXZ 52英寸 4K超高清", "skuCode" : "skuCode2", "brandName" : "三星", "closeUserCode" : [ "uc0022" ], "channelType" : "cloudPlatform", "shopCode" : "sc00001", "publicPrice" : "8288.88", "groupPrice" : null, "boxPrice" : [ { "boxType" : "box1", "boxUserCode" : [ "uc0022" ], "boxPriceDetail" : 4288.88 } ], "boostValue" : 1.2 } }, { "_index" : "my_goods_new", "_type" : "_doc", "_id" : "10", "_score" : 1.0, "_source" : { "goodsName" : "三星UA55RU7520JXXZ 52英寸 4K超高清", "skuCode" : "skuCode2", "brandName" : "三星", "closeUserCode" : [ "uc0022" ], "channelType" : "cloudPlatform", "shopCode" : "sc00001", "publicPrice" : "8288.88", "groupPrice" : null, "boxPrice" : [ { "boxType" : "box1", "boxUserCode" : [ "uc0022" ], "boxPriceDetail" : 4288.88 } ], "boostValue" : 1.8 } } ] } }
Get
对文档的查询操作支持以下类型:
GET <index>/_doc/<_id> HEAD <index>/_doc/<_id> GET <index>/_source/<_id> HEAD <index>/_source/<_id>
查询文档 ID 为 1 的文档信息:
GET /my_goods/_doc/1
查询文档 ID 为 1 的文档是否存在,只判断文档是否存在,head 返回的信息更少、性能更高,满足特殊业务场景使用:
HEAD /my_goods/_doc/1
返回:
200 - OK
只返回文档信息
查询时只返回 _source 信息:
GET /my_goods/_source/1
返回:
{ "goodsName" : "苹果 51英寸 4K超高清", "skuCode" : "skuCode1", "brandName" : "苹果", "closeUserCode" : [ "0" ], "channelType" : "cloudPlatform", "shopCode" : "sc00001", "publicPrice" : "8188.88", "groupPrice" : null, "boxPrice" : null, "boostValue" : 1.8 }
《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.2.Elasticsearch基础应用——3.4.2.3.Search通过Kibana(5) https://developer.aliyun.com/article/1231066