question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Elasticsearch sort not work in "es.query"

See original GitHub issue

when set es.query to:

{
  "query" : {
    "bool" : {
      "filter" : {
        "range" : {
          "collectionTimestamp" : {
            "from" : "2016-01-04T00:00Z",
            "to" : "2016-01-04T00:00:10Z",
            "include_lower" : true,
            "include_upper" : true
          }
        }
      },
      "minimum_should_match" : "1"
    }
  },
  "sort" : [ {
    "vendor" : {
      "order" : "asc",
      "missing" : "_first"
    }
  } ]
}

the query partition works good but results are not ordered.

If order by spark, spark first get all elements and then sort them to get just 10 first elements and this is very slow if results are large. but if use elasticsearch sort, when spark gets 10 first elements, it finishes the work and return the results.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
ebuildycommented, Nov 9, 2017

At least, an error could be thrown to indicate this is not supported.

0reactions
jbaieracommented, Aug 2, 2017

Closing this since the conversation has slowed down and drifted from the original issue. The usage of sorting within an input split is a very niche use case and not one that we have on the immediate roadmap. If there is still reasonable push from the community for it then a new issue should be opened for the feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Elasticsearch is not sorting the results - Stack Overflow
The problem is that elasticsearch always returns the same results. The query part works fine, however returns the same list for asc and...
Read more >
Sort search results | Elasticsearch Guide [8.5] | Elastic
When sorting, the relevant sorted field values are loaded into memory. This means that per shard, there should be enough memory to contain...
Read more >
How Do I Sort in Elasticsearch? - Linux Hint
We can sort Elasticsearch results using the sort keyword. The sort query requires you to provide a field under which to sort. Elasticsearch...
Read more >
Sorting of results in Elasticsearch | Asc, Desc ... - YouTube
In this elastic search tutorial, we discuss about Sorting the search results in Elasticsearch. This is part of Query DSL (Domain Specific ...
Read more >
8. Sorting and Relevance - Elasticsearch - O'Reilly
In order to sort by relevance, we need to represent relevance as a value. In Elasticsearch, the relevance score is represented by the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found