Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
How to correctly set the sort mode of a query with Bodybuilder?

I've picked up a project that uses Bodybuilder.js for queries to ELK and I am struggling to figure out how to format the query with Bodybuilder. I should note that I've tested this same query in other languages and it worked fine.

As I had written it previously it was:

"sort" {
    "duration": {
        "order": "desc",
        "mode": "max"
    }
}

As far as I can tell from the docs (end of the last example) it should be written something like:

.sort([{ "duration": { "order": "desc", "mode": "max" }}])

but this query is giving me an error from the server. I should note that:

.sort("duration", "desc")

on the other hand does not give an error, but does not give the desired result, just to clear up any concern about the key itself.

Information on this is a bit sparse but hopefully someone who's ran into this before can offer some help as the docs aren't giving me more than I mentioned and that's not working.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!