18.1. Get Map Function

Before using the creating, searching, updating etc. functions, you can display the ElasticSearch map.

For example:

 1<?php
 2
 3$map = $elastic->index()
 4                ->name('my-index')
 5                ->mappings(function(){
 6                        return $this
 7                                ->body([
 8                                    'properties' => [
 9                                        'location.keyword' => [
10                                            'type' => 'geo_shape',
11                                        ]
12                                    ]
13                                ])
14                                ->getMap();
15                })
16                ->getMap(); // it returns map
17
18return $map;
19
20// You will get something like that:
21/* {"index":"my-index","body":{"mappings":{"properties":{"location.keyword":{"ty pe":"geo_shape"}}}}} */