// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples

[source, js]
----
const response = await client.search({
  index: "my_test_scores",
  query: {
    term: {
      grad_year: "2099",
    },
  },
  sort: [
    {
      _script: {
        type: "number",
        script: {
          source: "doc['math_score'].value + doc['verbal_score'].value",
        },
        order: "desc",
      },
    },
  ],
});
console.log(response);
----
