wockan
(Wockan)
November 23, 2015, 1:40pm
1
Hi,
We have a problem with aggregations since we upgraded from 1.1.1 to 1.7.3 (yeah it's a bit of a huge jump)
what we want is to group by user and get the doc count
in 1.1.1 we filtered by
users.id = 1
aggregation term users.id
we got:
"key": 1
"doc_count:" 3
in 1.7.3
we get:
"key": DOC ID
"doc_count:" 1
"key": DOC ID
"doc_count:" 1
"key": DOC ID
"doc_count:" 1
this happens only to Arrays (not nested) and not inner objects.
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"terms": {
"users.id": [
"160"
]
}
}
]
}
}
}
},
"aggs": {
"users_group": {
"terms": {
"field":"users.id"
}
}
},
"size": 0
}
jpountz
(Adrien Grand)
November 23, 2015, 3:24pm
2
Can you provide us with an example that reproduces the issue?
wockan
(Wockan)
November 24, 2015, 1:30pm
3
Hello here you go
Query:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"terms": {
"users.id": [
"160"
]
}
}
]
}
}
}
},
"aggs": {
"users_group": {
"terms": {
"field":"users.id"
}
}
},
"size": 0
}
Mapping:
had to shorten the mapping a bit because 5000 max limit forum.
Hopefully nothing relating
{
"spcrm_0": {
"mappings": {
"activities": {
"_id": {
"path": "id"
},
"_parent": {
"type": "clients"
},
"_routing": {
"required": true
},
"properties": {
"activityType": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "string",
"index": "no",
"fields": {
"description": {
"type": "string"
},
"query": {
"type": "string",
"analyzer": "analyzer_startswith"
}
}
}
}
},
"client": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "string",
"fields": {
"query": {
"type": "string",
"analyzer": "analyzer_startswith"
}
}
},
"phone": {
"type": "string"
}
}
},
"closeDate": {
"type": "date",
"format": "dateOptionalTime"
},
"contacts": {
"properties": {
"cellPhone": {
"type": "string"
},
"id": {
"type": "long"
},
"name": {
"type": "string",
"fields": {
"query": {
"type": "string",
"analyzer": "analyzer_startswith"
}
}
},
"phone": {
"type": "string"
}
}
},
"date": {
"type": "date",
"format": "dateOptionalTime"
},
"description": {
"type": "string",
"fields": {
"query": {
"type": "string",
"analyzer": "analyzer_startswith"
}
}
},
"id": {
"type": "long"
},
"users": {
"properties": {
"email": {
"type": "string"
},
"id": {
"type": "long"
},
"name": {
"type": "string",
"fields": {
"query": {
"type": "string",
"analyzer": "analyzer_startswith"
}
}
}
}
}
}
}
}
}
}