|
| 1 | +--- |
| 2 | +setup: |
| 3 | + - requires: |
| 4 | + cluster_features: [ "gte_v8.14.0" ] |
| 5 | + reason: "GEO_MATCH ENRICH support was added in 8.14.0" |
| 6 | + test_runner_features: allowed_warnings_regex |
| 7 | + |
| 8 | + - do: |
| 9 | + indices.create: |
| 10 | + index: regions |
| 11 | + body: |
| 12 | + mappings: |
| 13 | + properties: |
| 14 | + shape: |
| 15 | + type: geo_shape |
| 16 | + region: |
| 17 | + type: keyword |
| 18 | + |
| 19 | + - do: |
| 20 | + bulk: |
| 21 | + index: regions |
| 22 | + refresh: true |
| 23 | + body: |
| 24 | + - { "index": { } } |
| 25 | + - { "shape": "POLYGON ((12.453 55.7122, 12.4785 55.6563, 12.5332 55.6318, 12.5955 55.6802, 12.5963 55.7125, 12.6398 55.7224, 12.6022 55.7257, 12.5905 55.7097, 12.5659 55.7327, 12.453 55.7122), (12.4913 55.6791, 12.5381 55.6977, 12.5573 55.6817, 12.5233 55.6665, 12.4913 55.6791))", "region": "Copenhagen" } |
| 26 | + - { "index": { } } |
| 27 | + - { "shape": "POLYGON ((4.0 50.46, 4.01 50.46, 4.01 50.48, 4.0 50.48, 4.0 50.46))", "region": "Obourg" } |
| 28 | + |
| 29 | +--- |
| 30 | +"locations_geo_point_valid_shapes": |
| 31 | + - do: |
| 32 | + indices.create: |
| 33 | + index: locations |
| 34 | + body: |
| 35 | + settings: |
| 36 | + index.number_of_shards: 1 |
| 37 | + index.routing.rebalance.enable: "none" |
| 38 | + mappings: |
| 39 | + properties: |
| 40 | + location: |
| 41 | + type: geo_point |
| 42 | + name: |
| 43 | + type: keyword |
| 44 | + |
| 45 | + - do: |
| 46 | + bulk: |
| 47 | + index: locations |
| 48 | + refresh: true |
| 49 | + body: |
| 50 | + - { "index": { } } |
| 51 | + - { "location": { "type": "point","coordinates": [ 4.0053486386, 50.4697386503 ] }, "name": "GeoJSON" } |
| 52 | + - { "index": { } } |
| 53 | + - { "location": "POINT(4.0053486386 50.4697386503)", "name": "WKT" } |
| 54 | + |
| 55 | + - do: |
| 56 | + enrich.put_policy: |
| 57 | + name: locations-policy |
| 58 | + body: |
| 59 | + geo_match: |
| 60 | + indices: [ "locations" ] |
| 61 | + match_field: "location" |
| 62 | + enrich_fields: [ "name", "location" ] |
| 63 | + |
| 64 | + - do: |
| 65 | + enrich.execute_policy: |
| 66 | + name: locations-policy |
| 67 | + |
| 68 | + - do: |
| 69 | + cluster.health: |
| 70 | + wait_for_no_initializing_shards: true |
| 71 | + wait_for_events: languid |
| 72 | + |
| 73 | + - do: |
| 74 | + allowed_warnings_regex: |
| 75 | + - "No limit defined, adding default limit of \\[.*\\]" |
| 76 | + esql.query: |
| 77 | + body: |
| 78 | + query: 'FROM regions | ENRICH locations-policy ON shape' |
| 79 | + |
| 80 | + - match: { columns.0.name: "region" } |
| 81 | + - match: { columns.0.type: "keyword" } |
| 82 | + - match: { columns.1.name: "shape" } |
| 83 | + - match: { columns.1.type: "geo_shape" } |
| 84 | + - match: { columns.2.name: "name" } |
| 85 | + - match: { columns.2.type: "keyword" } |
| 86 | + - match: { columns.3.name: "location" } |
| 87 | + - match: { columns.3.type: "geo_shape" } |
| 88 | + |
| 89 | + - length: { values: 2 } |
| 90 | + - match: { values.0: [ "Copenhagen", "POLYGON ((12.453 55.7122, 12.4785 55.6563, 12.5332 55.6318, 12.5955 55.6802, 12.5963 55.7125, 12.6398 55.7224, 12.6022 55.7257, 12.5905 55.7097, 12.5659 55.7327, 12.453 55.7122), (12.4913 55.6791, 12.5381 55.6977, 12.5573 55.6817, 12.5233 55.6665, 12.4913 55.6791))", null, null ] } |
| 91 | + - match: { values.1: [ "Obourg", "POLYGON ((4.0 50.46, 4.01 50.46, 4.01 50.48, 4.0 50.48, 4.0 50.46))", ["GeoJSON", "WKT"], ["POINT (4.0053486386 50.4697386503)", "POINT (4.0053486386 50.4697386503)"] ] } |
| 92 | + |
| 93 | + - do: |
| 94 | + enrich.delete_policy: |
| 95 | + name: locations-policy |
| 96 | + |
| 97 | +--- |
| 98 | +"locations_keyword_valid_shapes": |
| 99 | + |
| 100 | + - do: |
| 101 | + indices.create: |
| 102 | + index: locations |
| 103 | + body: |
| 104 | + settings: |
| 105 | + index.number_of_shards: 1 |
| 106 | + index.routing.rebalance.enable: "none" |
| 107 | + mappings: |
| 108 | + properties: |
| 109 | + location: |
| 110 | + type: keyword |
| 111 | + name: |
| 112 | + type: keyword |
| 113 | + |
| 114 | + - do: |
| 115 | + bulk: |
| 116 | + index: locations |
| 117 | + refresh: true |
| 118 | + body: |
| 119 | + - { "index": { } } |
| 120 | + - { "location": "POINT(4.0053486386 50.4697386503)", "name": "WKT" } |
| 121 | + |
| 122 | + - do: |
| 123 | + enrich.put_policy: |
| 124 | + name: locations-policy |
| 125 | + body: |
| 126 | + geo_match: |
| 127 | + indices: [ "locations" ] |
| 128 | + match_field: "location" |
| 129 | + enrich_fields: [ "name", "location" ] |
| 130 | + |
| 131 | + - do: |
| 132 | + enrich.execute_policy: |
| 133 | + name: locations-policy |
| 134 | + |
| 135 | + - do: |
| 136 | + cluster.health: |
| 137 | + wait_for_no_initializing_shards: true |
| 138 | + wait_for_events: languid |
| 139 | + |
| 140 | + - do: |
| 141 | + allowed_warnings_regex: |
| 142 | + - "No limit defined, adding default limit of \\[.*\\]" |
| 143 | + esql.query: |
| 144 | + body: |
| 145 | + query: 'FROM regions | ENRICH locations-policy ON shape' |
| 146 | + |
| 147 | + - match: { columns.0.name: "region" } |
| 148 | + - match: { columns.0.type: "keyword" } |
| 149 | + - match: { columns.1.name: "shape" } |
| 150 | + - match: { columns.1.type: "geo_shape" } |
| 151 | + - match: { columns.2.name: "name" } |
| 152 | + - match: { columns.2.type: "keyword" } |
| 153 | + - match: { columns.3.name: "location" } |
| 154 | + - match: { columns.3.type: "geo_shape" } |
| 155 | + |
| 156 | + - length: { values: 2 } |
| 157 | + - match: { values.0: [ "Copenhagen", "POLYGON ((12.453 55.7122, 12.4785 55.6563, 12.5332 55.6318, 12.5955 55.6802, 12.5963 55.7125, 12.6398 55.7224, 12.6022 55.7257, 12.5905 55.7097, 12.5659 55.7327, 12.453 55.7122), (12.4913 55.6791, 12.5381 55.6977, 12.5573 55.6817, 12.5233 55.6665, 12.4913 55.6791))", null, null ] } |
| 158 | + - match: { values.1: [ "Obourg", "POLYGON ((4.0 50.46, 4.01 50.46, 4.01 50.48, 4.0 50.48, 4.0 50.46))", "WKT", "POINT (4.0053486386 50.4697386503)" ] } |
| 159 | + |
| 160 | + - do: |
| 161 | + enrich.delete_policy: |
| 162 | + name: locations-policy |
| 163 | + |
| 164 | +--- |
| 165 | +"locations_geo_point_invalid_shapes": |
| 166 | + - do: |
| 167 | + indices.create: |
| 168 | + index: locations |
| 169 | + body: |
| 170 | + settings: |
| 171 | + index.number_of_shards: 1 |
| 172 | + index.routing.rebalance.enable: "none" |
| 173 | + mappings: |
| 174 | + properties: |
| 175 | + location: |
| 176 | + type: geo_point |
| 177 | + name: |
| 178 | + type: keyword |
| 179 | + |
| 180 | + - do: |
| 181 | + bulk: |
| 182 | + index: locations |
| 183 | + refresh: true |
| 184 | + body: |
| 185 | + - { "index": { } } |
| 186 | + - { "location": { "type": "point","coordinates": [ 4.0053486386, 50.4697386503 ] }, "name": "GeoJSON" } |
| 187 | + - { "index": { } } |
| 188 | + - { "location": "POINT(4.0053486386 50.4697386503)", "name": "WKT" } |
| 189 | + - { "index": { } } |
| 190 | + - { "location": { "lon": 4.0053486386, "lat": 50.4697386503 }, "name": "Object(lat,lon)" } |
| 191 | + |
| 192 | + - do: |
| 193 | + enrich.put_policy: |
| 194 | + name: locations-policy |
| 195 | + body: |
| 196 | + geo_match: |
| 197 | + indices: [ "locations" ] |
| 198 | + match_field: "location" |
| 199 | + enrich_fields: [ "name", "location" ] |
| 200 | + |
| 201 | + - do: |
| 202 | + catch: "/Encountered bulk failures during reindex process/" |
| 203 | + enrich.execute_policy: |
| 204 | + name: locations-policy |
| 205 | + |
| 206 | + - do: |
| 207 | + enrich.delete_policy: |
| 208 | + name: locations-policy |
| 209 | + |
| 210 | +--- |
| 211 | +"locations_keyword_invalid_shapes": |
| 212 | + - do: |
| 213 | + indices.create: |
| 214 | + index: locations |
| 215 | + body: |
| 216 | + settings: |
| 217 | + index.number_of_shards: 1 |
| 218 | + index.routing.rebalance.enable: "none" |
| 219 | + mappings: |
| 220 | + properties: |
| 221 | + location: |
| 222 | + type: keyword |
| 223 | + name: |
| 224 | + type: keyword |
| 225 | + |
| 226 | + - do: |
| 227 | + bulk: |
| 228 | + index: locations |
| 229 | + refresh: true |
| 230 | + body: |
| 231 | + - { "index": { } } |
| 232 | + - { "location": "POINT(4.0053486386 50.4697386503)", "name": "WKT" } |
| 233 | + - { "index": { } } |
| 234 | + - { "location": "50.4697386503,4.0053486386", "name": "lat,lon" } |
| 235 | + |
| 236 | + - do: |
| 237 | + enrich.put_policy: |
| 238 | + name: locations-policy |
| 239 | + body: |
| 240 | + geo_match: |
| 241 | + indices: [ "locations" ] |
| 242 | + match_field: "location" |
| 243 | + enrich_fields: [ "name", "location" ] |
| 244 | + |
| 245 | + - do: |
| 246 | + catch: "/Encountered bulk failures during reindex process/" |
| 247 | + enrich.execute_policy: |
| 248 | + name: locations-policy |
| 249 | + |
| 250 | + - do: |
| 251 | + enrich.delete_policy: |
| 252 | + name: locations-policy |
0 commit comments