Im getting very odd behavior from elasticseach_dsl
Im running the following from python
es_controller.es_dsl.index('management_users') \
.doc_type('user') \
.filter('term', email=email).execute()
When it's translated by elasticsearch_dsl
into a query, in some cases it will add size: 0
to the query which will return 0 results.
Here's the query I see in the debug info
{
"query": {
"bool": {
"filter": [
{
"term": {
"email": "aviran@domain.com"
}
}
],
"must": [
{
"regexp": {
"first_name": ".*"
}
}
]
}
},
"aggs": {
"total_cost": {
"sum": {
"field": "cost"
}
},
"total_liters": {
"sum": {
"field": "liters"
}
}
},
"size": 0
}
The response is:
{
"took": 13,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0,
"hits": []
},
"aggregations": {
"total_cost": {
"value": 0
},
"total_liters": {
"value": 0
}
}
}
What am I doing wrong?
The described behavior is not consistent, on some case the outgoing query will be:
{
"query": {
"bool": {
"filter": [
{
"term": {
"email": "aviran@domain.com"
}
}
]
}
}
}
Which works fine.
Im using:
elasticsearch 5.5.3
elasticsearch-dsl 5.4.0