// 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.searchApplication.put({
  name: "my-search-app",
  search_application: {
    indices: ["index1"],
    template: {
      script: {
        lang: "mustache",
        source:
          '\n      {\n        "retriever": {\n          "rrf": {\n            "retrievers": [\n              {{#text_fields}}\n              {\n                "standard": {\n                  "query": {\n                    "match": {\n                      "{{.}}": "{{query_string}}"\n                    }\n                  }\n                }\n              },\n              {{/text_fields}}\n              {{#elser_fields}}\n              {\n                "standard": {\n                  "query": {\n                    "sparse_vector": {\n                      "field": "ml.inference.{{.}}_expanded.predicted_value",\n                      "inference_id": "<elser_inference_id>",\n                      "query": "{{query_string}}"\n                    }\n                  }\n                }\n              },\n              {{/elser_fields}}\n            ],\n            "rank_window_size": {{rrf.rank_window_size}},\n            "rank_constant": {{rrf.rank_constant}}\n          }\n        }\n      }\n      ',
        params: {
          elser_fields: ["title", "meta_description"],
          text_fields: ["title", "meta_description"],
          query_string: "",
          rrf: {
            rank_window_size: 100,
            rank_constant: 60,
          },
        },
      },
    },
  },
});
console.log(response);
----
