// 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.index({
  index: "library",
  refresh: "true",
  document: {
    title: "Book #1",
    rating: 200.1,
  },
});
console.log(response);

const response1 = await client.index({
  index: "library",
  refresh: "true",
  document: {
    title: "Book #2",
    rating: 1.7,
  },
});
console.log(response1);

const response2 = await client.index({
  index: "library",
  refresh: "true",
  document: {
    title: "Book #3",
    rating: 0.1,
  },
});
console.log(response2);

const response3 = await client.search({
  filter_path: "hits.hits._source",
  _source: "title",
  sort: "rating:desc",
});
console.log(response3);
----
