|
| 1 | +--- |
| 2 | +setup: |
| 3 | + - requires: |
| 4 | + cluster_features: ["gte_v8.11.0"] |
| 5 | + reason: "ESQL is available in 8.11+" |
| 6 | + test_runner_features: allowed_warnings_regex |
| 7 | + - do: |
| 8 | + indices.create: |
| 9 | + index: cities |
| 10 | + body: |
| 11 | + settings: |
| 12 | + number_of_shards: 5 |
| 13 | + mappings: |
| 14 | + properties: |
| 15 | + city_code: |
| 16 | + type: keyword |
| 17 | + city: |
| 18 | + type: text |
| 19 | + country: |
| 20 | + type: keyword |
| 21 | + |
| 22 | + - do: |
| 23 | + bulk: |
| 24 | + index: cities |
| 25 | + refresh: true |
| 26 | + body: |
| 27 | + - { "index": { } } |
| 28 | + - { "city_code": "nyc", "city": "New York", "country": "USA" } |
| 29 | + - { "index": { } } |
| 30 | + - { "city_code": "rom", "city": "Rome", "country": "Italy" } |
| 31 | + |
| 32 | + - do: |
| 33 | + enrich.put_policy: |
| 34 | + name: city_codes)policy |
| 35 | + body: |
| 36 | + match: |
| 37 | + indices: [ "cities" ] |
| 38 | + match_field: "city_code" |
| 39 | + enrich_fields: [ "city", "country" ] |
| 40 | + |
| 41 | + |
| 42 | + - do: |
| 43 | + enrich.execute_policy: |
| 44 | + name: city_codes)policy |
| 45 | + |
| 46 | + |
| 47 | + - do: |
| 48 | + indices.create: |
| 49 | + index: test |
| 50 | + body: |
| 51 | + mappings: |
| 52 | + properties: |
| 53 | + name: |
| 54 | + type: keyword |
| 55 | + city_id: |
| 56 | + type: keyword |
| 57 | + city_name: |
| 58 | + type: text |
| 59 | + - do: |
| 60 | + bulk: |
| 61 | + index: test |
| 62 | + refresh: true |
| 63 | + body: |
| 64 | + - { "index": { } } |
| 65 | + - { "name": "Alice", "city_id": "nyc", "city_name": "New York" } |
| 66 | + - { "index": { } } |
| 67 | + - { "name": "Bob", "city_id": "nyc", "city_name": "New York" } |
| 68 | + - { "index": { } } |
| 69 | + - { "name": "Mario", "city_id": "rom", "city_name": "Rome" } |
| 70 | + - { "index": { } } |
| 71 | + - { "name": "Denise", "city_id": "sgn", "city_name": "Tan Son Nhat" } |
| 72 | + |
| 73 | +--- |
| 74 | +"Enrich on keyword": |
| 75 | + - requires: |
| 76 | + test_runner_features: [ capabilities, allowed_warnings_regex ] |
| 77 | + capabilities: |
| 78 | + - method: POST |
| 79 | + path: /_query |
| 80 | + parameters: [ ] |
| 81 | + capabilities: [ no_brackets_in_unquoted_index_names ] |
| 82 | + reason: "Change in the grammar" |
| 83 | + |
| 84 | + - do: |
| 85 | + allowed_warnings_regex: |
| 86 | + - "No limit defined, adding default limit of \\[.*\\]" |
| 87 | + esql.query: |
| 88 | + body: |
| 89 | + query: 'from test | enrich "city_codes)policy" on city_id | keep name, city, country | sort name' |
| 90 | + |
| 91 | + - match: { columns.0.name: "name" } |
| 92 | + - match: { columns.0.type: "keyword" } |
| 93 | + - match: { columns.1.name: "city" } |
| 94 | + - match: { columns.1.type: "text" } |
| 95 | + - match: { columns.2.name: "country" } |
| 96 | + - match: { columns.2.type: "keyword" } |
| 97 | + |
| 98 | + - length: { values: 4 } |
| 99 | + - match: { values.0: [ "Alice", "New York", "USA" ] } |
| 100 | + - match: { values.1: [ "Bob", "New York", "USA" ] } |
| 101 | + - match: { values.2: [ "Denise", null, null ] } |
| 102 | + - match: { values.3: [ "Mario", "Rome", "Italy" ] } |
0 commit comments