-----------------------------
name = galaxy note
attributes
type = phone
weight = 140gm
-----------------------------
name = shirt
attributes
type = clothing
size = m
-----------------------------
name = iphone x
attributes
type = phone
screen size = 6.5 inch
-----------------------------
(See GET /catalog/article/_search below... )
我可以通过哪个请求检索当前搜索中可用的所有属性键,结果如下:
我可以使用哪个请求来检索当前搜索中可用于特定属性键的所有属性值,其结果类似于检索“类型”时的结果:
或者甚至更好,更轻松的请求,在我的当前搜索中将这两个信息重新组合在一起:
类型
体重
大小
屏幕尺寸
GET /catalog/article/_search
{
"hits": {
"hits": [
{
"_score": 1,
"_type": "article",
"_id": "POczfGsBETE745IKleND",
"_source": {
"attributes": [
{
"key": "type",
"value": "phone"
},
{
"key": "weight",
"value": "140gm"
}
],
"price": 123,
"name": "galaxy note"
},
"_index": "catalog"
},
{
"_score": 1,
"_type": "article",
"_id": "1gTQgGsBOIP8-uDJcAWg",
"_source": {
"attributes": [
{
"key": "type",
"value": "clothing"
},
{
"key": "size",
"value": "m"
}
],
"price": 123,
"name": "shirt"
},
"_index": "catalog"
},
{
"_score": 1,
"_type": "article",
"_id": "Pef1kmsBETE745IKaeM1",
"_source": {
"attributes": [
{
"key": "type",
"value": "phone"
},
{
"key": "screen size",
"value": "6.5 inch"
}
],
"price": 599,
"name": "iphone x"
},
"_index": "catalog"
}
],
"total": {
"relation": "eq",
"value": 3
},
"max_score": 1
},
"_shards": {
"successful": 1,
"failed": 0,
"skipped": 0,
"total": 1
},
"took": 3,
"timed_out": false
}