POST /_search
{
"size": 0,
"aggs": {
"by_grp" : {
"terms": {
"field": "grpId",
"size": 0
},
"aggs": {
"twitter_count": {
"range": {
"field": "twitter.followers",
"ranges": [
{ "to" : 501},
{ "from" : 501, "to" : 1001},
{ "from" : 1001, "to" : 5001},
{ "from" : 5001}
]
},
"aggs" : {
"email_addy": {
"terms" : {
"field": "email.value",
"size": 0
}
}
}
}
}
}
}
}
使用elastic-search-dsl,我的python代码是
from datetime import datetime
from elasticsearch_dsl import DocType, String, Date, Integer, Search, Q
from elasticsearch_dsl.connections import connections
from elasticsearch import Elasticsearch
client = connections.create_connection(hosts=['http://somehost:9200'])
s = Search(using=client, index="dexy", doc_type="grp")
s.aggs.bucket('by_grp', 'terms', field='grpId', size=0) \
.bucket('twitter_count', 'range', field='twitter.followers')
我在哪里可以在这里定义 CURL 代码中的范围?GIT 和文档目前在这个主题上很少。未找到示例。