// 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.indices.create({
  index: "my-index-000001",
  mappings: {
    properties: {
      text: {
        type: "text",
        analyzer: "standard",
      },
      impact: {
        type: "sparse_vector",
      },
      positive: {
        type: "sparse_vector",
      },
      negative: {
        type: "sparse_vector",
      },
    },
  },
});
console.log(response);

const response1 = await client.index({
  index: "my-index-000001",
  document: {
    text: "I had some terribly delicious carrots.",
    impact: [
      {
        I: 0.55,
        had: 0.4,
        some: 0.28,
        terribly: 0.01,
        delicious: 1.2,
        carrots: 0.8,
      },
      {
        I: 0.54,
        had: 0.4,
        some: 0.28,
        terribly: 2.01,
        delicious: 0.02,
        carrots: 0.4,
      },
    ],
    positive: {
      I: 0.55,
      had: 0.4,
      some: 0.28,
      terribly: 0.01,
      delicious: 1.2,
      carrots: 0.8,
    },
    negative: {
      I: 0.54,
      had: 0.4,
      some: 0.28,
      terribly: 2.01,
      delicious: 0.02,
      carrots: 0.4,
    },
  },
});
console.log(response1);

const response2 = await client.search({
  index: "my-index-000001",
  query: {
    term: {
      impact: {
        value: "delicious",
      },
    },
  },
});
console.log(response2);
----
