// 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: {
      topics: {
        type: "rank_features",
      },
      negative_reviews: {
        type: "rank_features",
        positive_score_impact: false,
      },
    },
  },
});
console.log(response);

const response1 = await client.index({
  index: "my-index-000001",
  id: 1,
  document: {
    topics: {
      politics: 20,
      economics: 50.8,
    },
    negative_reviews: {
      "1star": 10,
      "2star": 100,
    },
  },
});
console.log(response1);

const response2 = await client.index({
  index: "my-index-000001",
  id: 2,
  document: {
    topics: {
      politics: 5.2,
      sports: 80.1,
    },
    negative_reviews: {
      "1star": 1,
      "2star": 10,
    },
  },
});
console.log(response2);

const response3 = await client.search({
  index: "my-index-000001",
  query: {
    rank_feature: {
      field: "topics.politics",
    },
  },
});
console.log(response3);

const response4 = await client.search({
  index: "my-index-000001",
  query: {
    rank_feature: {
      field: "negative_reviews.1star",
    },
  },
});
console.log(response4);

const response5 = await client.search({
  index: "my-index-000001",
  query: {
    term: {
      topics: "economics",
    },
  },
});
console.log(response5);
----
