File: 89aed93f641a5e243bdc3ee5cdc2acc6.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 (58 lines) | stat: -rw-r--r-- 3,295 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// This file is autogenerated, DO NOT EDIT
// search/search-your-data/search-application-api.asciidoc:484

[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              {{#text}}\n              {\n                \"multi_match\": {\n                  \"query\": \"{{query_string}}\",\n                  \"fields\": [{{#text_fields}}\"{{name}}^{{boost}}\",{{/text_fields}}],\n                  \"boost\": \"{{text_query_boost}}\"\n                }\n              },\n              {{/text}}\n              {{#elser}}\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              { \"bool\": { \"must\": [] } },\n              {{/elser}}\n              {{^text}}\n              {{^elser}}\n              {\n                \"query_string\": {\n                  \"query\": \"{{query_string}}\",\n                  \"default_field\": \"{{default_field}}\",\n                  \"default_operator\": \"{{default_operator}}\",\n                  \"boost\": \"{{text_query_boost}}\"\n                }\n              },\n              {{/elser}}\n              {{/text}}\n              { \"bool\": { \"must\": [] } }\n              ],\n            \"minimum_should_match\": 1\n          }\n        },\n        \"min_score\": \"{{min_score}}\",\n        \"explain\": \"{{explain}}\",\n        \"from\": \"{{from}}\",\n        \"size\": \"{{size}}\"\n      }\n      ",
                "params": {
                    "text": False,
                    "elser": False,
                    "elser_fields": [
                        {
                            "name": "title",
                            "boost": 1
                        },
                        {
                            "name": "description",
                            "boost": 1
                        }
                    ],
                    "text_fields": [
                        {
                            "name": "title",
                            "boost": 10
                        },
                        {
                            "name": "description",
                            "boost": 5
                        },
                        {
                            "name": "state",
                            "boost": 1
                        }
                    ],
                    "query_string": "*",
                    "text_query_boost": 4,
                    "default_field": "*",
                    "default_operator": "OR",
                    "explain": False,
                    "from": 0,
                    "size": 10,
                    "min_score": 0
                }
            }
        }
    },
)
print(resp)
----