Sort descending with JavaScript API


(el) #1

This is a syntax question. In my search I want to sort descending on a
field named 'no'. I tried things like params.sort = "no: {order: 'desc'}"
or params.sort = "[{'no': {'order': 'desc'}}]" but nothings works. If I
just specify params.sort = "no" the ascending sort works fine. Can somebody
give me a hint please?

--
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/b26ebaad-827f-47d4-b328-51e9ece016c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(ElasticSearch Users mailing list) #2

Can you try:

client.search({
  body: q,
  sort: "no:desc"
});

--
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/63bef7a5-63c8-4d2b-92c0-b27c3157b18e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(el) #3

Great, this works. Thanks a lot.

--
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/c171f577-2d60-42de-82e0-bec45e2c4921%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4