多字段聚合

前端之家收集整理的这篇文章主要介绍了多字段聚合前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

curl -XPOST localhost:9200/photo -d '{

"photo": {

"properties": {

"id": {

"type": "String"

},

"title": {

"type": "String"

},

"category":{

"type": "String"

},

"uploader_name": {

"type": "String"

},

"uploader_id": {

"type": "String"

},

"keyword": {

"properties":{

"categoryId":{

"type": "String"

},

"content":{

"type": "String"

}

}

}

}

}

}'




curl -XPOST localhost:9200/photo/photo/1 -d '{

"id":"1",

"title":"北京天坛风景",

"uploader_name":"felayman",

"uploader_id":"1",

"keyword":[

{

"categoryId":"1",

"content":"北京"

},

{

"categoryId":"2",

"content":"天坛"

},

{

"categoryId":"3",

"content":"秋天"

},

{

"categoryId":"4",

"content":"旅游"

}

]

}'



curl -XPOST localhost:9200/photo/photo/2 -d '{

"id":"2",

"title":"河南",

"content":"旅游"

}

]

}'



curl -XGET 'localhost:9200/photo/photo/_search?pretty' -d '{

"aggregations": {

"agg": {

"terms": {

"field": "keyword.categoryId"

}

}

}

}'


curl -XPOST 'localhost:9200/photo/photo/2/_update' -d '{

"doc": {"keyword" : [{

"categoryId":"2",

"content":"旅游"

}]}

}';

猜你在找的设计模式相关文章