Pranjut
Pranjut

Reputation: 1777

sort query is overriding bool query while using elastic4s

Below is my code snippet for the query I am trying with elastic4s. Somehow the sortByFieldAsc is overriding the bool and because of that I am unable to get the correct result. I am trying to go through different examples but have not got any solution for it.

elastic4s version = 7.17.2

client execute {
    search("index").bool({ bool(Nil, Seq(should(matchQuery("something.outthere", s"*outthere*"))), Nil) })
      .from(0).size(100).sortByFieldAsc("something.date")
  }

Upvotes: 0

Views: 95

Answers (1)

Pranjut
Pranjut

Reputation: 1777

I got a work around for this or probably that is the way to actually do it instead of trying it with sortyByFieldAsc. The solution was to sort the index itself. We can apply setting for the same in the elastic-search.

Upvotes: 0

Related Questions