@@ -60,7 +60,7 @@ private function getClient(): Client
60
60
->setLogger ($ this ->logger );
61
61
62
62
if (getenv ('TEST_SUITE ' ) === 'platinum ' ) {
63
- $ client ->setSSLVerification (__DIR__ . ' /../../../.ci/certs/ca.crt ' );
63
+ $ client ->setSSLVerification (false );
64
64
}
65
65
return $ client ->build ();
66
66
}
@@ -153,6 +153,98 @@ public function testIndexCannotBeArrayOfNullsForDelete()
153
153
);
154
154
}
155
155
156
+ /**
157
+ * @see https://github.com/elastic/elasticsearch/blob/master/rest-api-spec/src/main/resources/rest-api-spec/api/search_mvt.json
158
+ */
159
+ public function testSupportMapBoxVectorTiles ()
160
+ {
161
+ $ client = $ this ->getClient ();
162
+
163
+ if (Utility::getVersion ($ client ) < '7.15 ' ) {
164
+ $ this ->markTestSkipped (sprintf (
165
+ "The %s test requires Elasticsearch 7.15+ " ,
166
+ __FUNCTION__
167
+ ));
168
+ }
169
+
170
+ // Create a museums index with a custom mappings
171
+ $ client ->indices ()->create ([
172
+ 'index ' => 'museums ' ,
173
+ 'body ' => [
174
+ "mappings " => [
175
+ "properties " => [
176
+ "location " => ["type " => "geo_point " ],
177
+ "name " => ["type " => "keyword " ],
178
+ "price " => ["type " => "long " ],
179
+ "included " => ["type " => "boolean " ]
180
+ ]
181
+ ]
182
+ ]
183
+ ]);
184
+
185
+ // Bulk some documents
186
+ $ body = [
187
+ [ "index " => [ "_id " => "1 " ]],
188
+ [ "location " => "52.374081,4.912350 " , "name " => "NEMO Science Museum " , "price " => 1750 , "included " => true ],
189
+ [ "index " => [ "_id " => "2 " ]],
190
+ [ "location " => "52.369219,4.901618 " , "name " => "Museum Het Rembrandthuis " , "price " => 1500 , "included " => false ],
191
+ [ "index " => [ "_id " => "3 " ]],
192
+ [ "location " => "52.371667,4.914722 " , "name " => "Nederlands Scheepvaartmuseum " , "price " => 1650 , "included " => true ],
193
+ [ "index " => [ "_id " => "4 " ]],
194
+ [ "location " => "52.371667,4.914722 " , "name " => "Amsterdam Centre for Architecture " , "price " => 0 , "included " => true ]
195
+ ];
196
+ $ client ->bulk ([
197
+ 'index ' => 'museums ' ,
198
+ 'refresh ' => true ,
199
+ 'body ' => $ body
200
+ ]);
201
+
202
+ $ body = [
203
+ "grid_precision " => 2 ,
204
+ "fields " => ["name " , "price " ],
205
+ "query " => [
206
+ "term " => [
207
+ "included " => true
208
+ ]
209
+ ],
210
+ "aggs " => [
211
+ "min_price " => [
212
+ "min " => [
213
+ "field " => "price "
214
+ ]
215
+ ],
216
+ "max_price " => [
217
+ "max " => [
218
+ "field " => "price "
219
+ ]
220
+ ],
221
+ "avg_price " => [
222
+ "avg " => [
223
+ "field " => "price "
224
+ ]
225
+ ]
226
+ ]
227
+ ];
228
+
229
+ // Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile.
230
+ $ response = $ client ->searchMvt ([
231
+ 'index ' => 'museums ' ,
232
+ 'field ' => 'location ' ,
233
+ 'zoom ' => 13 ,
234
+ 'x ' => 4207 ,
235
+ 'y ' => 2692 ,
236
+ 'body ' => $ body
237
+ ]);
238
+
239
+ // Remove the index museums
240
+ $ client ->indices ()->delete ([
241
+ 'index ' => 'museums '
242
+ ]);
243
+
244
+ $ this ->assertIsString ($ response );
245
+ $ this ->assertStringContainsString ('NEMO Science Museum ' , $ response );
246
+ }
247
+
156
248
private function getLevelOutput (string $ level , array $ output ): string
157
249
{
158
250
foreach ($ output as $ out ) {
0 commit comments