Terms Facet - "Excluded" being ignored?


(Ólafur Gauti Guðmundsson) #1

Hi,
I'm running ElasticSearch 0.15.0. For some reason, ElasticSearch is
ignoring my "excluded" terms in a "terms" facet.
I'm pretty sure this was working before.

Is there anything that has changed in this regard, or can you spot an
error in my JSON below?

Many thanks,
OGG

Here is my query (note the exclude setting on "categories" and
"advType" facets):

{
"from": 0,
"size": 25,
"query": {
"match_all": {}
},
"sort": [{
"creationDate": {
"reverse": true
}
}, "_score"],
"highlight": {
"fields": {
"headline": {},
"body": {}
}
},
"facets": {
"categories": {
"terms": {
"field": "category",
"size": 20,
"order": "count",
"exclude": [0, 22]
}
},
"advTypes": {
"terms": {
"field": "advType",
"size": 10,
"order": "count",
"exclude": [0]
}
},
"tags": {
"terms": {
"field": "tags",
"size": 10,
"order": "count"
}
},
"priceHistogram": {
"histogram": {
"field": "prices",
"interval": 20000
}
},
"dateRange": {
"range": {
"creationDate": [{
"from": "2011-03-17"
}, {
"from": "2011-03-10"
}, {
"from": "2011-02-17"
}, {
"to": "2011-02-17"
}]
}
}
}
}

And following is the facets part of the response I get back
(irrelevant facets omitted for brevity):

"facets": {
"categories": {
"_type": "terms",
"missing": 0,
"terms": [{
"term": 8,
"count": 6259
}, {
"term": 12,
"count": 4588
}, {
"term": 4,
"count": 4080
}, {
"term": 7,
"count": 3391
}, {
"term": 1,
"count": 2574
}, {
"term": 15,
"count": 2224
}, {
"term": 3,
"count": 2118
}, {
"term": 10,
"count": 1458
}, {
"term": 13,
"count": 1018
}, {
"term": 17,
"count": 805
}, {
"term": 18,
"count": 763
}, {
"term": 9,
"count": 500
}, {
"term": 11,
"count": 460
}, {
"term": 0,
"count": 390
}, {
"term": 16,
"count": 324
}, {
"term": 20,
"count": 286
}, {
"term": 14,
"count": 252
}, {
"term": 2,
"count": 158
}, {
"term": 22,
"count": 105
}, {
"term": 19,
"count": 84
}]
},
"advTypes": {
"_type": "terms",
"missing": 0,
"terms": [{
"term": 1,
"count": 23114
}, {
"term": 2,
"count": 6571
}, {
"term": 0,
"count": 1318
}, {
"term": 4,
"count": 436
}, {
"term": 3,
"count": 413
}]
}
}


(Shay Banon) #2

In 0.15, terms facet on numeric fields has been greatly enhanced when it comes to performance, but, the exclude functionally was not implemented for terms facet on numeric fields. It should have been..., can you open an issue?
On Thursday, March 17, 2011 at 4:26 PM, Ólafur Gauti Guðmundsson wrote:

Hi,
I'm running ElasticSearch 0.15.0. For some reason, ElasticSearch is
ignoring my "excluded" terms in a "terms" facet.
I'm pretty sure this was working before.

Is there anything that has changed in this regard, or can you spot an
error in my JSON below?

Many thanks,
OGG

Here is my query (note the exclude setting on "categories" and
"advType" facets):

{
"from": 0,
"size": 25,
"query": {
"match_all": {}
},
"sort": [{
"creationDate": {
"reverse": true
}
}, "_score"],
"highlight": {
"fields": {
"headline": {},
"body": {}
}
},
"facets": {
"categories": {
"terms": {
"field": "category",
"size": 20,
"order": "count",
"exclude": [0, 22]
}
},
"advTypes": {
"terms": {
"field": "advType",
"size": 10,
"order": "count",
"exclude": [0]
}
},
"tags": {
"terms": {
"field": "tags",
"size": 10,
"order": "count"
}
},
"priceHistogram": {
"histogram": {
"field": "prices",
"interval": 20000
}
},
"dateRange": {
"range": {
"creationDate": [{
"from": "2011-03-17"
}, {
"from": "2011-03-10"
}, {
"from": "2011-02-17"
}, {
"to": "2011-02-17"
}]
}
}
}
}

And following is the facets part of the response I get back
(irrelevant facets omitted for brevity):

"facets": {
"categories": {
"_type": "terms",
"missing": 0,
"terms": [{
"term": 8,
"count": 6259
}, {
"term": 12,
"count": 4588
}, {
"term": 4,
"count": 4080
}, {
"term": 7,
"count": 3391
}, {
"term": 1,
"count": 2574
}, {
"term": 15,
"count": 2224
}, {
"term": 3,
"count": 2118
}, {
"term": 10,
"count": 1458
}, {
"term": 13,
"count": 1018
}, {
"term": 17,
"count": 805
}, {
"term": 18,
"count": 763
}, {
"term": 9,
"count": 500
}, {
"term": 11,
"count": 460
}, {
"term": 0,
"count": 390
}, {
"term": 16,
"count": 324
}, {
"term": 20,
"count": 286
}, {
"term": 14,
"count": 252
}, {
"term": 2,
"count": 158
}, {
"term": 22,
"count": 105
}, {
"term": 19,
"count": 84
}]
},
"advTypes": {
"_type": "terms",
"missing": 0,
"terms": [{
"term": 1,
"count": 23114
}, {
"term": 2,
"count": 6571
}, {
"term": 0,
"count": 1318
}, {
"term": 4,
"count": 436
}, {
"term": 3,
"count": 413
}]
}
}


(Ólafur Gauti Guðmundsson) #3

Hi,
Thanks for the quick reply.
I created an issue for this: https://github.com/elasticsearch/elasticsearch/issues/789

Regards,
OGG

On Mar 17, 6:37 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

In 0.15, terms facet on numeric fields has been greatly enhanced when it comes to performance, but, the exclude functionally was not implemented for terms facet on numeric fields. It should have been..., can you open an issue?

On Thursday, March 17, 2011 at 4:26 PM, Ólafur Gauti Guðmundsson wrote:

Hi,
I'm running ElasticSearch 0.15.0. For some reason, ElasticSearch is
ignoring my "excluded" terms in a "terms" facet.
I'm pretty sure this was working before.

Is there anything that has changed in this regard, or can you spot an
error in my JSON below?

Many thanks,
OGG

Here is my query (note the exclude setting on "categories" and
"advType" facets):

{
"from": 0,
"size": 25,
"query": {
"match_all": {}
},
"sort": [{
"creationDate": {
"reverse": true
}
}, "_score"],
"highlight": {
"fields": {
"headline": {},
"body": {}
}
},
"facets": {
"categories": {
"terms": {
"field": "category",
"size": 20,
"order": "count",
"exclude": [0, 22]
}
},
"advTypes": {
"terms": {
"field": "advType",
"size": 10,
"order": "count",
"exclude": [0]
}
},
"tags": {
"terms": {
"field": "tags",
"size": 10,
"order": "count"
}
},
"priceHistogram": {
"histogram": {
"field": "prices",
"interval": 20000
}
},
"dateRange": {
"range": {
"creationDate": [{
"from": "2011-03-17"
}, {
"from": "2011-03-10"
}, {
"from": "2011-02-17"
}, {
"to": "2011-02-17"
}]
}
}
}
}

And following is the facets part of the response I get back
(irrelevant facets omitted for brevity):

"facets": {
"categories": {
"_type": "terms",
"missing": 0,
"terms": [{
"term": 8,
"count": 6259
}, {
"term": 12,
"count": 4588
}, {
"term": 4,
"count": 4080
}, {
"term": 7,
"count": 3391
}, {
"term": 1,
"count": 2574
}, {
"term": 15,
"count": 2224
}, {
"term": 3,
"count": 2118
}, {
"term": 10,
"count": 1458
}, {
"term": 13,
"count": 1018
}, {
"term": 17,
"count": 805
}, {
"term": 18,
"count": 763
}, {
"term": 9,
"count": 500
}, {
"term": 11,
"count": 460
}, {
"term": 0,
"count": 390
}, {
"term": 16,
"count": 324
}, {
"term": 20,
"count": 286
}, {
"term": 14,
"count": 252
}, {
"term": 2,
"count": 158
}, {
"term": 22,
"count": 105
}, {
"term": 19,
"count": 84
}]
},
"advTypes": {
"_type": "terms",
"missing": 0,
"terms": [{
"term": 1,
"count": 23114
}, {
"term": 2,
"count": 6571
}, {
"term": 0,
"count": 1318
}, {
"term": 4,
"count": 436
}, {
"term": 3,
"count": 413
}]
}
}


(system) #4