Sorting on multiple fields issue

Hi

I am new to ES and recently been moved to another project where I have to
maintain it temporarily. I have this query that I am running and am doing
sort of two fields from the same table that are part of ES index. We are
currently using version 0.90.0 of ES

here is the mapping:

{
"SomeIndex":{
"properties":{
"Classifications":{
"properties":{
"Id":{
"type":"long"
},
"Name":{
"type":"string"
},
"NameSortable":{
"type":"string",
"index":"not_analyzed"
},
"Type":{
"type":"long"
}
}
}
}
}
}

There are two types [1, 2]

I want to sort by types first and then by NameSortable. However, my query
seems to sort only by NameSortable. Please see below for the query:
{
"from": 0,
"size": 15,
"query": {
"bool": {
"must": {
"term": {
"State": 3
}
},
"should": [
{
"terms": {
....,
"minimum_match": 1
}
},
{
"terms": {
....,
"minimum_match": 1
}
}
],
"minimum_number_should_match": 1
}
},
"sort": [
{
"Classifications.Type": {}
},
{
"Classifications.NameSortable": {}
},
{
"Date": {
"order": "desc"
}
}
]
}

Can some please advise why it is doing the sort in the right order?

Many thanks

ESKFA

--
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.

On Monday, July 1, 2013 12:47:45 PM UTC+1, Baktash Ahmed wrote:

Hi

I am new to ES and recently been moved to another project where I have to
maintain it temporarily. I have this query that I am running and am doing
sort of two fields from the same table that are part of ES index. We are
currently using version 0.90.0 of ES

here is the mapping:

{
"SomeIndex":{
"properties":{
"Classifications":{
"properties":{
"Id":{
"type":"long"
},
"Name":{
"type":"string"
},
"NameSortable":{
"type":"string",
"index":"not_analyzed"
},
"Type":{
"type":"long"
}
}
}
}
}
}

There are two types [1, 2]

I want to sort by types first and then by NameSortable. However, my query
seems to sort only by NameSortable. Please see below for the query:
{
"from": 0,
"size": 15,
"query": {
"bool": {
"must": {
"term": {
"State": 3
}
},
"should": [
{
"terms": {
....,
"minimum_match": 1
}
},
{
"terms": {
....,
"minimum_match": 1
}
}
],
"minimum_number_should_match": 1
}
},
"sort": [
{
"Classifications.Type": {}
},
{
"Classifications.NameSortable": {}
},
{
"Date": {
"order": "desc"
}
}
]
}

Can some please advise why it is NOT doing the sort in the right order?

Many thanks

ESKFA

--
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.