can someone show me how to frame this example query using this dsl python module?
I have only so far something like for a portion of the query string.
from elasticsearch_dsl import Search, Q, A, query, aggs
s = Search()
s.aggs.bucket('2', 'terms', field = 'Subscriber Type', size=5)
I'm not sure how the syntax is for the rest of the query. Any help is much appreciated.
The required query construction is below.
{
"size": 0,
"query": {
"filtered": {
"query": {
"query_string": {
"query": "lincoln",
"analyze_wildcard": true
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"Start date": {
"gte": 936157359664,
"lte": 1472701359665,
"format": "epoch_millis"
}
}
}
],
"must_not": []
}
}
}
},
"aggs": {
"2": {
"terms": {
"field": "Subscriber Type",
"size": 5,
"order": {
"_count": "desc"
}
},
"aggs": {
"3": {
"terms": {
"field": "Start Station",
"size": 5,
"order": {
"_count": "desc"
}
}
}
}
}
}
}