Term facet ordering

Hi,

I have an issue related to the ordering of the term facets. It seems that
the ordering does not work properly when there are upper / lower case.

This is the facet definition:

{
"size": 0,
"facets" : {
"location" : {
"terms" : {
"field" : "location.untouched",
"size" : 10,
"order" : "term"
}
}
}
}

And this is the response:

{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 814,
"max_score": 1,
"hits": []
},
"facets": {
"location": {
"_type": "terms",
"missing": 49,
"total": 781,
"other": 739,
"terms": [
{
"term": "AR - Little Rock",
"count": 2
},
{
"term": "AZ -Phoenix",
"count": 3
},
{
"term": "Aberdeen",
"count": 1
},
{
"term": "Abu Dhabi",
"count": 1
},
{
"term": "Alberta - Calgary",
"count": 1
},
{
"term": "Almere",
"count": 11
},
{
"term": "Amazonas - Manaus",
"count": 1
},
{
"term": "Amsterdam",
"count": 18
},
{
"term": "Athens",
"count": 1
},
{
"term": "Bangkok",
"count": 3
}
]
}
}
}

"AR - Little Rock" should not be the first location.

Best Regards,
Roberto.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

from an encoding point of view this seems to be OK to me? A < B < a < b so
"AR" < "Ab"
I am not saying that this is ok from an application point of view but that
is a different story. I'd ask you to open a dev issues for this to maybe
plug in
some colaltion based sorting?

simon

On Monday, August 19, 2013 1:22:32 PM UTC+2, roberto.m...@gmail.com wrote:

Hi,

I have an issue related to the ordering of the term facets. It seems that
the ordering does not work properly when there are upper / lower case.

This is the facet definition:

{
"size": 0,
"facets" : {
"location" : {
"terms" : {
"field" : "location.untouched",
"size" : 10,
"order" : "term"
}
}
}
}

And this is the response:

{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 814,
"max_score": 1,
"hits": []
},
"facets": {
"location": {
"_type": "terms",
"missing": 49,
"total": 781,
"other": 739,
"terms": [
{
"term": "AR - Little Rock",
"count": 2
},
{
"term": "AZ -Phoenix",
"count": 3
},
{
"term": "Aberdeen",
"count": 1
},
{
"term": "Abu Dhabi",
"count": 1
},
{
"term": "Alberta - Calgary",
"count": 1
},
{
"term": "Almere",
"count": 11
},
{
"term": "Amazonas - Manaus",
"count": 1
},
{
"term": "Amsterdam",
"count": 18
},
{
"term": "Athens",
"count": 1
},
{
"term": "Bangkok",
"count": 3
}
]
}
}
}

"AR - Little Rock" should not be the first location.

Best Regards,
Roberto.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

At first glance, this appears to be correct. But with the assumption that
location.untouched is a field that is not analyzed at all.

What if you change location.untouched to be lowercased but not tokenized?
I've applied facets to analyzed fields that included folded case filters,
and the sorting is in the expected order with case-insensitive collation.

Brian

On Monday, August 19, 2013 7:22:32 AM UTC-4, roberto.m...@gmail.com wrote:

Hi,

I have an issue related to the ordering of the term facets. It seems that
the ordering does not work properly when there are upper / lower case.

This is the facet definition:

{
"size": 0,
"facets" : {
"location" : {
"terms" : {
"field" : "location.untouched",
"size" : 10,
"order" : "term"
}
}
}
}

And this is the response:

{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 814,
"max_score": 1,
"hits": []
},
"facets": {
"location": {
"_type": "terms",
"missing": 49,
"total": 781,
"other": 739,
"terms": [
{
"term": "AR - Little Rock",
"count": 2
},
{
"term": "AZ -Phoenix",
"count": 3
},
{
"term": "Aberdeen",
"count": 1
},
{
"term": "Abu Dhabi",
"count": 1
},
{
"term": "Alberta - Calgary",
"count": 1
},
{
"term": "Almere",
"count": 11
},
{
"term": "Amazonas - Manaus",
"count": 1
},
{
"term": "Amsterdam",
"count": 18
},
{
"term": "Athens",
"count": 1
},
{
"term": "Bangkok",
"count": 3
}
]
}
}
}

"AR - Little Rock" should not be the first location.

Best Regards,
Roberto.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

@simonw: Yes, I assumed that was what was happening.

@InquiringMind: Yes, location.untouched is not analyzed. As you suggested,
I have modified the field mapping from not_analized to a custom analyzer
with lowercase filter and keyword tokenizer, and it's working as I was
expecting.

Many thanks

Roberto.

El lunes, 19 de agosto de 2013 22:02:27 UTC+2, InquiringMind escribió:

At first glance, this appears to be correct. But with the assumption that
location.untouched is a field that is not analyzed at all.

What if you change location.untouched to be lowercased but not tokenized?
I've applied facets to analyzed fields that included folded case filters,
and the sorting is in the expected order with case-insensitive collation.

Brian

On Monday, August 19, 2013 7:22:32 AM UTC-4, roberto.m...@gmail.com wrote:

Hi,

I have an issue related to the ordering of the term facets. It seems that
the ordering does not work properly when there are upper / lower case.

This is the facet definition:

{
"size": 0,
"facets" : {
"location" : {
"terms" : {
"field" : "location.untouched",
"size" : 10,
"order" : "term"
}
}
}
}

And this is the response:

{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 814,
"max_score": 1,
"hits": []
},
"facets": {
"location": {
"_type": "terms",
"missing": 49,
"total": 781,
"other": 739,
"terms": [
{
"term": "AR - Little Rock",
"count": 2
},
{
"term": "AZ -Phoenix",
"count": 3
},
{
"term": "Aberdeen",
"count": 1
},
{
"term": "Abu Dhabi",
"count": 1
},
{
"term": "Alberta - Calgary",
"count": 1
},
{
"term": "Almere",
"count": 11
},
{
"term": "Amazonas - Manaus",
"count": 1
},
{
"term": "Amsterdam",
"count": 18
},
{
"term": "Athens",
"count": 1
},
{
"term": "Bangkok",
"count": 3
}
]
}
}
}

"AR - Little Rock" should not be the first location.

Best Regards,
Roberto.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.