File: a9dd5cd3f2b31e7c8129ea63bab868b4.asciidoc

package info (click to toggle)
python-elasticsearch 9.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 22,728 kB
  • sloc: python: 104,053; makefile: 151; javascript: 75
file content (34 lines) | stat: -rw-r--r-- 1,427 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:656

[source, python]
----
resp = client.search_application.put(
    name="my_search_application",
    search_application={
        "indices": [
            "index1",
            "index2"
        ],
        "template": {
            "script": {
                "lang": "mustache",
                "source": "\n        {\n          \"query\": {\n            \"bool\": {\n              \"should\": [\n                {{#elser_fields}}\n                {\n                  \"sparse_vector\": {\n                      \"field\": \"ml.inference.{{.}}_expanded.predicted_value\",\n                      \"inference_id\": \"<elser_inference_id>\",\n                      \"query\": \"{{query_string}}\"\n                    }\n                },\n                {{/elser_fields}}\n                ]\n            }\n          },\n          \"min_score\": \"{{min_score}}\"\n        }\n        ",
                "params": {
                    "query_string": "*",
                    "min_score": "10",
                    "elser_fields": [
                        {
                            "name": "title"
                        },
                        {
                            "name": "description"
                        }
                    ]
                }
            }
        }
    },
)
print(resp)
----