Sort using lucene-like syntax


(Vladimir Khazin) #1

Is there a way to specify multi-field and/or descending sort order using
lucene-like syntax e.g.:

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO
2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO
25])"
}
},
"sort": "AvailableDate desc"
}

Or

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO
2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO
25])"
}
},
"sort": "AvailableDate, AssetId"
}

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b52df7cd-363b-49fa-b792-c03585e9cdd0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Are you looking for this? http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 9 décembre 2013 at 21:12:43, Vladimir Khazin (vladimir.khazin@icssolutions.ca) a écrit:

Is there a way to specify multi-field and/or descending sort order using lucene-like syntax e.g.:

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO 2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO 25])"
}
},
"sort": "AvailableDate desc"
}

Or

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO 2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO 25])"
}
},
"sort": "AvailableDate, AssetId"
}

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b52df7cd-363b-49fa-b792-c03585e9cdd0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52a6294e.5bd062c2.2987%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


(Vladimir Khazin) #3

Thank you for quick response!

This is somewhat static, I was hoping to provide ui with ability to specify
dynamic sort order using Lucerne like syntax.
On Dec 9, 2013 3:34 PM, "David Pilato" david@pilato.fr wrote:

Are you looking for this?
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 9 décembre 2013 at 21:12:43, Vladimir Khazin (
vladimir.khazin@icssolutions.ca //vladimir.khazin@icssolutions.ca) a
écrit:

Is there a way to specify multi-field and/or descending sort order using
lucene-like syntax e.g.:

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO
2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO
25])"
}
},
"sort": "AvailableDate desc"
}

Or

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO
2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO
25])"
}
},
"sort": "AvailableDate, AssetId"
}

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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/b52df7cd-363b-49fa-b792-c03585e9cdd0%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/YTxiMPGNYJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/etPan.52a6294e.5bd062c2.2987%40MacBook-Air-de-David.local
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAMnv9kaKYLPmMvYBr_WXrb0viZDSc%2BHVOFfH8BBa3Kh768CT7A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #4

I don't really see the difference between:

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO 2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO 25])"
}
},
"sort": "AvailableDate desc"
}

And

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO 2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO 25])"
}
},
"sort": [
{ "AvailableDate" : "desc" }
]
}

May be I'm missing something.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 9 décembre 2013 at 21:39:48, Vladimir Khazin (vladimir.khazin@icssolutions.ca) a écrit:

Thank you for quick response!

This is somewhat static, I was hoping to provide ui with ability to specify dynamic sort order using Lucerne like syntax.

On Dec 9, 2013 3:34 PM, "David Pilato" david@pilato.fr wrote:
Are you looking for this? http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-sort.html

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 9 décembre 2013 at 21:12:43, Vladimir Khazin (vladimir.khazin@icssolutions.ca) a écrit:

Is there a way to specify multi-field and/or descending sort order using lucene-like syntax e.g.:

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO 2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO 25])"
}
},
"sort": "AvailableDate desc"
}

Or

{
"size": 128,
"query": {
"query_string" : {
"query" : "(Gravity) AND (AssetStatus:1 AND AvailableDate:[* TO 2013-11-29] AND ExpirationDate:[2013-11-29 TO ] AND MaturityRating:[ TO 25])"
}
},
"sort": "AvailableDate, AssetId"
}

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b52df7cd-363b-49fa-b792-c03585e9cdd0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/YTxiMPGNYJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52a6294e.5bd062c2.2987%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAMnv9kaKYLPmMvYBr_WXrb0viZDSc%2BHVOFfH8BBa3Kh768CT7A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52a62eac.1f16e9e8.2987%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5