elasticsearch/_async/client/__init__.py [4947:5425]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        self,
        *,
        index: t.Union[str, t.Sequence[str]],
        field: str,
        zoom: int,
        x: int,
        y: int,
        aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
        buffer: t.Optional[int] = None,
        error_trace: t.Optional[bool] = None,
        exact_bounds: t.Optional[bool] = None,
        extent: t.Optional[int] = None,
        fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        grid_agg: t.Optional[t.Union[str, t.Literal["geohex", "geotile"]]] = None,
        grid_precision: t.Optional[int] = None,
        grid_type: t.Optional[
            t.Union[str, t.Literal["centroid", "grid", "point"]]
        ] = None,
        human: t.Optional[bool] = None,
        pretty: t.Optional[bool] = None,
        query: t.Optional[t.Mapping[str, t.Any]] = None,
        runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
        size: t.Optional[int] = None,
        sort: t.Optional[
            t.Union[
                t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
                t.Union[str, t.Mapping[str, t.Any]],
            ]
        ] = None,
        track_total_hits: t.Optional[t.Union[bool, int]] = None,
        with_labels: t.Optional[bool] = None,
        body: t.Optional[t.Dict[str, t.Any]] = None,
    ) -> BinaryApiResponse:
        """
        .. raw:: html

          <p>Search a vector tile.</p>
          <p>Search a vector tile for geospatial values.
          Before using this API, you should be familiar with the Mapbox vector tile specification.
          The API returns results as a binary mapbox vector tile.</p>
          <p>Internally, Elasticsearch translates a vector tile search API request into a search containing:</p>
          <ul>
          <li>A <code>geo_bounding_box</code> query on the <code>&lt;field&gt;</code>. The query uses the <code>&lt;zoom&gt;/&lt;x&gt;/&lt;y&gt;</code> tile as a bounding box.</li>
          <li>A <code>geotile_grid</code> or <code>geohex_grid</code> aggregation on the <code>&lt;field&gt;</code>. The <code>grid_agg</code> parameter determines the aggregation type. The aggregation uses the <code>&lt;zoom&gt;/&lt;x&gt;/&lt;y&gt;</code> tile as a bounding box.</li>
          <li>Optionally, a <code>geo_bounds</code> aggregation on the <code>&lt;field&gt;</code>. The search only includes this aggregation if the <code>exact_bounds</code> parameter is <code>true</code>.</li>
          <li>If the optional parameter <code>with_labels</code> is <code>true</code>, the internal search will include a dynamic runtime field that calls the <code>getLabelPosition</code> function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.</li>
          </ul>
          <p>For example, Elasticsearch may translate a vector tile search API request with a <code>grid_agg</code> argument of <code>geotile</code> and an <code>exact_bounds</code> argument of <code>true</code> into the following search</p>
          <pre><code>GET my-index/_search
          {
            &quot;size&quot;: 10000,
            &quot;query&quot;: {
              &quot;geo_bounding_box&quot;: {
                &quot;my-geo-field&quot;: {
                  &quot;top_left&quot;: {
                    &quot;lat&quot;: -40.979898069620134,
                    &quot;lon&quot;: -45
                  },
                  &quot;bottom_right&quot;: {
                    &quot;lat&quot;: -66.51326044311186,
                    &quot;lon&quot;: 0
                  }
                }
              }
            },
            &quot;aggregations&quot;: {
              &quot;grid&quot;: {
                &quot;geotile_grid&quot;: {
                  &quot;field&quot;: &quot;my-geo-field&quot;,
                  &quot;precision&quot;: 11,
                  &quot;size&quot;: 65536,
                  &quot;bounds&quot;: {
                    &quot;top_left&quot;: {
                      &quot;lat&quot;: -40.979898069620134,
                      &quot;lon&quot;: -45
                    },
                    &quot;bottom_right&quot;: {
                      &quot;lat&quot;: -66.51326044311186,
                      &quot;lon&quot;: 0
                    }
                  }
                }
              },
              &quot;bounds&quot;: {
                &quot;geo_bounds&quot;: {
                  &quot;field&quot;: &quot;my-geo-field&quot;,
                  &quot;wrap_longitude&quot;: false
                }
              }
            }
          }
          </code></pre>
          <p>The API returns results as a binary Mapbox vector tile.
          Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:</p>
          <ul>
          <li>A <code>hits</code> layer containing a feature for each <code>&lt;field&gt;</code> value matching the <code>geo_bounding_box</code> query.</li>
          <li>An <code>aggs</code> layer containing a feature for each cell of the <code>geotile_grid</code> or <code>geohex_grid</code>. The layer only contains features for cells with matching data.</li>
          <li>A meta layer containing:
          <ul>
          <li>A feature containing a bounding box. By default, this is the bounding box of the tile.</li>
          <li>Value ranges for any sub-aggregations on the <code>geotile_grid</code> or <code>geohex_grid</code>.</li>
          <li>Metadata for the search.</li>
          </ul>
          </li>
          </ul>
          <p>The API only returns features that can display at its zoom level.
          For example, if a polygon feature has no area at its zoom level, the API omits it.
          The API returns errors as UTF-8 encoded JSON.</p>
          <p>IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter.
          If you specify both parameters, the query parameter takes precedence.</p>
          <p><strong>Grid precision for geotile</strong></p>
          <p>For a <code>grid_agg</code> of <code>geotile</code>, you can use cells in the <code>aggs</code> layer as tiles for lower zoom levels.
          <code>grid_precision</code> represents the additional zoom levels available through these cells. The final precision is computed by as follows: <code>&lt;zoom&gt; + grid_precision</code>.
          For example, if <code>&lt;zoom&gt;</code> is 7 and <code>grid_precision</code> is 8, then the <code>geotile_grid</code> aggregation will use a precision of 15.
          The maximum final precision is 29.
          The <code>grid_precision</code> also determines the number of cells for the grid as follows: <code>(2^grid_precision) x (2^grid_precision)</code>.
          For example, a value of 8 divides the tile into a grid of 256 x 256 cells.
          The <code>aggs</code> layer only contains features for cells with matching data.</p>
          <p><strong>Grid precision for geohex</strong></p>
          <p>For a <code>grid_agg</code> of <code>geohex</code>, Elasticsearch uses <code>&lt;zoom&gt;</code> and <code>grid_precision</code> to calculate a final precision as follows: <code>&lt;zoom&gt; + grid_precision</code>.</p>
          <p>This precision determines the H3 resolution of the hexagonal cells produced by the <code>geohex</code> aggregation.
          The following table maps the H3 resolution for each precision.
          For example, if <code>&lt;zoom&gt;</code> is 3 and <code>grid_precision</code> is 3, the precision is 6.
          At a precision of 6, hexagonal cells have an H3 resolution of 2.
          If <code>&lt;zoom&gt;</code> is 3 and <code>grid_precision</code> is 4, the precision is 7.
          At a precision of 7, hexagonal cells have an H3 resolution of 3.</p>
          <table>
          <thead>
          <tr>
          <th>Precision</th>
          <th>Unique tile bins</th>
          <th>H3 resolution</th>
          <th>Unique hex bins</th>
          <th>Ratio</th>
          </tr>
          </thead>
          <tbody>
          <tr>
          <td>1</td>
          <td>4</td>
          <td>0</td>
          <td>122</td>
          <td>30.5</td>
          </tr>
          <tr>
          <td>2</td>
          <td>16</td>
          <td>0</td>
          <td>122</td>
          <td>7.625</td>
          </tr>
          <tr>
          <td>3</td>
          <td>64</td>
          <td>1</td>
          <td>842</td>
          <td>13.15625</td>
          </tr>
          <tr>
          <td>4</td>
          <td>256</td>
          <td>1</td>
          <td>842</td>
          <td>3.2890625</td>
          </tr>
          <tr>
          <td>5</td>
          <td>1024</td>
          <td>2</td>
          <td>5882</td>
          <td>5.744140625</td>
          </tr>
          <tr>
          <td>6</td>
          <td>4096</td>
          <td>2</td>
          <td>5882</td>
          <td>1.436035156</td>
          </tr>
          <tr>
          <td>7</td>
          <td>16384</td>
          <td>3</td>
          <td>41162</td>
          <td>2.512329102</td>
          </tr>
          <tr>
          <td>8</td>
          <td>65536</td>
          <td>3</td>
          <td>41162</td>
          <td>0.6280822754</td>
          </tr>
          <tr>
          <td>9</td>
          <td>262144</td>
          <td>4</td>
          <td>288122</td>
          <td>1.099098206</td>
          </tr>
          <tr>
          <td>10</td>
          <td>1048576</td>
          <td>4</td>
          <td>288122</td>
          <td>0.2747745514</td>
          </tr>
          <tr>
          <td>11</td>
          <td>4194304</td>
          <td>5</td>
          <td>2016842</td>
          <td>0.4808526039</td>
          </tr>
          <tr>
          <td>12</td>
          <td>16777216</td>
          <td>6</td>
          <td>14117882</td>
          <td>0.8414913416</td>
          </tr>
          <tr>
          <td>13</td>
          <td>67108864</td>
          <td>6</td>
          <td>14117882</td>
          <td>0.2103728354</td>
          </tr>
          <tr>
          <td>14</td>
          <td>268435456</td>
          <td>7</td>
          <td>98825162</td>
          <td>0.3681524172</td>
          </tr>
          <tr>
          <td>15</td>
          <td>1073741824</td>
          <td>8</td>
          <td>691776122</td>
          <td>0.644266719</td>
          </tr>
          <tr>
          <td>16</td>
          <td>4294967296</td>
          <td>8</td>
          <td>691776122</td>
          <td>0.1610666797</td>
          </tr>
          <tr>
          <td>17</td>
          <td>17179869184</td>
          <td>9</td>
          <td>4842432842</td>
          <td>0.2818666889</td>
          </tr>
          <tr>
          <td>18</td>
          <td>68719476736</td>
          <td>10</td>
          <td>33897029882</td>
          <td>0.4932667053</td>
          </tr>
          <tr>
          <td>19</td>
          <td>274877906944</td>
          <td>11</td>
          <td>237279209162</td>
          <td>0.8632167343</td>
          </tr>
          <tr>
          <td>20</td>
          <td>1099511627776</td>
          <td>11</td>
          <td>237279209162</td>
          <td>0.2158041836</td>
          </tr>
          <tr>
          <td>21</td>
          <td>4398046511104</td>
          <td>12</td>
          <td>1660954464122</td>
          <td>0.3776573213</td>
          </tr>
          <tr>
          <td>22</td>
          <td>17592186044416</td>
          <td>13</td>
          <td>11626681248842</td>
          <td>0.6609003122</td>
          </tr>
          <tr>
          <td>23</td>
          <td>70368744177664</td>
          <td>13</td>
          <td>11626681248842</td>
          <td>0.165225078</td>
          </tr>
          <tr>
          <td>24</td>
          <td>281474976710656</td>
          <td>14</td>
          <td>81386768741882</td>
          <td>0.2891438866</td>
          </tr>
          <tr>
          <td>25</td>
          <td>1125899906842620</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.5060018015</td>
          </tr>
          <tr>
          <td>26</td>
          <td>4503599627370500</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.1265004504</td>
          </tr>
          <tr>
          <td>27</td>
          <td>18014398509482000</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.03162511259</td>
          </tr>
          <tr>
          <td>28</td>
          <td>72057594037927900</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.007906278149</td>
          </tr>
          <tr>
          <td>29</td>
          <td>288230376151712000</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.001976569537</td>
          </tr>
          </tbody>
          </table>
          <p>Hexagonal cells don't align perfectly on a vector tile.
          Some cells may intersect more than one vector tile.
          To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level.
          Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt>`_

        :param index: Comma-separated list of data streams, indices, or aliases to search
        :param field: Field containing geospatial data to return
        :param zoom: Zoom level for the vector tile to search
        :param x: X coordinate for the vector tile to search
        :param y: Y coordinate for the vector tile to search
        :param aggs: Sub-aggregations for the geotile_grid. It supports the following
            aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats`
            - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank`
            - `stats` - `sum` - `value count` The aggregation names can't start with
            `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations.
        :param buffer: The size, in pixels, of a clipping buffer outside the tile. This
            allows renderers to avoid outline artifacts from geometries that extend past
            the extent of the tile.
        :param exact_bounds: If `false`, the meta layer's feature is the bounding box
            of the tile. If `true`, the meta layer's feature is a bounding box resulting
            from a `geo_bounds` aggregation. The aggregation runs on <field> values that
            intersect the `<zoom>/<x>/<y>` tile with `wrap_longitude` set to `false`.
            The resulting bounding box may be larger than the vector tile.
        :param extent: The size, in pixels, of a side of the tile. Vector tiles are square
            with equal sides.
        :param fields: The fields to return in the `hits` layer. It supports wildcards
            (`*`). This parameter does not support fields with array values. Fields with
            array values may return inconsistent results.
        :param grid_agg: The aggregation used to create a grid for the `field`.
        :param grid_precision: Additional zoom levels available through the aggs layer.
            For example, if `<zoom>` is `7` and `grid_precision` is `8`, you can zoom
            in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer.
        :param grid_type: Determines the geometry type for features in the aggs layer.
            In the aggs layer, each feature represents a `geotile_grid` cell. If `grid,
            each feature is a polygon of the cells bounding box. If `point`, each feature
            is a Point that is the centroid of the cell.
        :param query: The query DSL used to filter documents for the search.
        :param runtime_mappings: Defines one or more runtime fields in the search request.
            These fields take precedence over mapped fields with the same name.
        :param size: The maximum number of features to return in the hits layer. Accepts
            0-10000. If 0, results don't include the hits layer.
        :param sort: Sort the features in the hits layer. By default, the API calculates
            a bounding box for each feature. It sorts features based on this box's diagonal
            length, from longest to shortest.
        :param track_total_hits: The number of hits matching the query to count accurately.
            If `true`, the exact number of hits is returned at the cost of some performance.
            If `false`, the response does not include the total number of hits matching
            the query.
        :param with_labels: If `true`, the hits and aggs layers will contain additional
            point features representing suggested label positions for the original features.
            * `Point` and `MultiPoint` features will have one of the points selected.
            * `Polygon` and `MultiPolygon` features will have a single point generated,
            either the centroid, if it is within the polygon, or another point within
            the polygon selected from the sorted triangle-tree. * `LineString` features
            will likewise provide a roughly central point selected from the triangle-tree.
            * The aggregation results will provide one central point for each aggregation
            bucket. All attributes from the original features will also be copied to
            the new label features. In addition, the new features will be distinguishable
            using the tag `_mvt_label_position`.
        """
        if index in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'index'")
        if field in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'field'")
        if zoom in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'zoom'")
        if x in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'x'")
        if y in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'y'")
        __path_parts: t.Dict[str, str] = {
            "index": _quote(index),
            "field": _quote(field),
            "zoom": _quote(zoom),
            "x": _quote(x),
            "y": _quote(y),
        }
        __path = f'/{__path_parts["index"]}/_mvt/{__path_parts["field"]}/{__path_parts["zoom"]}/{__path_parts["x"]}/{__path_parts["y"]}'
        __query: t.Dict[str, t.Any] = {}
        __body: t.Dict[str, t.Any] = body if body is not None else {}
        # The 'sort' parameter with a colon can't be encoded to the body.
        if sort is not None and (
            (isinstance(sort, str) and ":" in sort)
            or (
                isinstance(sort, (list, tuple))
                and all(isinstance(_x, str) for _x in sort)
                and any(":" in _x for _x in sort)
            )
        ):
            __query["sort"] = sort
            sort = None
        if error_trace is not None:
            __query["error_trace"] = error_trace
        if filter_path is not None:
            __query["filter_path"] = filter_path
        if human is not None:
            __query["human"] = human
        if pretty is not None:
            __query["pretty"] = pretty
        if not __body:
            if aggs is not None:
                __body["aggs"] = aggs
            if buffer is not None:
                __body["buffer"] = buffer
            if exact_bounds is not None:
                __body["exact_bounds"] = exact_bounds
            if extent is not None:
                __body["extent"] = extent
            if fields is not None:
                __body["fields"] = fields
            if grid_agg is not None:
                __body["grid_agg"] = grid_agg
            if grid_precision is not None:
                __body["grid_precision"] = grid_precision
            if grid_type is not None:
                __body["grid_type"] = grid_type
            if query is not None:
                __body["query"] = query
            if runtime_mappings is not None:
                __body["runtime_mappings"] = runtime_mappings
            if size is not None:
                __body["size"] = size
            if sort is not None:
                __body["sort"] = sort
            if track_total_hits is not None:
                __body["track_total_hits"] = track_total_hits
            if with_labels is not None:
                __body["with_labels"] = with_labels
        if not __body:
            __body = None  # type: ignore[assignment]
        __headers = {"accept": "application/vnd.mapbox-vector-tile"}
        if __body is not None:
            __headers["content-type"] = "application/json"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



elasticsearch/_sync/client/__init__.py [4945:5423]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        self,
        *,
        index: t.Union[str, t.Sequence[str]],
        field: str,
        zoom: int,
        x: int,
        y: int,
        aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
        buffer: t.Optional[int] = None,
        error_trace: t.Optional[bool] = None,
        exact_bounds: t.Optional[bool] = None,
        extent: t.Optional[int] = None,
        fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
        grid_agg: t.Optional[t.Union[str, t.Literal["geohex", "geotile"]]] = None,
        grid_precision: t.Optional[int] = None,
        grid_type: t.Optional[
            t.Union[str, t.Literal["centroid", "grid", "point"]]
        ] = None,
        human: t.Optional[bool] = None,
        pretty: t.Optional[bool] = None,
        query: t.Optional[t.Mapping[str, t.Any]] = None,
        runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
        size: t.Optional[int] = None,
        sort: t.Optional[
            t.Union[
                t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
                t.Union[str, t.Mapping[str, t.Any]],
            ]
        ] = None,
        track_total_hits: t.Optional[t.Union[bool, int]] = None,
        with_labels: t.Optional[bool] = None,
        body: t.Optional[t.Dict[str, t.Any]] = None,
    ) -> BinaryApiResponse:
        """
        .. raw:: html

          <p>Search a vector tile.</p>
          <p>Search a vector tile for geospatial values.
          Before using this API, you should be familiar with the Mapbox vector tile specification.
          The API returns results as a binary mapbox vector tile.</p>
          <p>Internally, Elasticsearch translates a vector tile search API request into a search containing:</p>
          <ul>
          <li>A <code>geo_bounding_box</code> query on the <code>&lt;field&gt;</code>. The query uses the <code>&lt;zoom&gt;/&lt;x&gt;/&lt;y&gt;</code> tile as a bounding box.</li>
          <li>A <code>geotile_grid</code> or <code>geohex_grid</code> aggregation on the <code>&lt;field&gt;</code>. The <code>grid_agg</code> parameter determines the aggregation type. The aggregation uses the <code>&lt;zoom&gt;/&lt;x&gt;/&lt;y&gt;</code> tile as a bounding box.</li>
          <li>Optionally, a <code>geo_bounds</code> aggregation on the <code>&lt;field&gt;</code>. The search only includes this aggregation if the <code>exact_bounds</code> parameter is <code>true</code>.</li>
          <li>If the optional parameter <code>with_labels</code> is <code>true</code>, the internal search will include a dynamic runtime field that calls the <code>getLabelPosition</code> function of the geometry doc value. This enables the generation of new point features containing suggested geometry labels, so that, for example, multi-polygons will have only one label.</li>
          </ul>
          <p>For example, Elasticsearch may translate a vector tile search API request with a <code>grid_agg</code> argument of <code>geotile</code> and an <code>exact_bounds</code> argument of <code>true</code> into the following search</p>
          <pre><code>GET my-index/_search
          {
            &quot;size&quot;: 10000,
            &quot;query&quot;: {
              &quot;geo_bounding_box&quot;: {
                &quot;my-geo-field&quot;: {
                  &quot;top_left&quot;: {
                    &quot;lat&quot;: -40.979898069620134,
                    &quot;lon&quot;: -45
                  },
                  &quot;bottom_right&quot;: {
                    &quot;lat&quot;: -66.51326044311186,
                    &quot;lon&quot;: 0
                  }
                }
              }
            },
            &quot;aggregations&quot;: {
              &quot;grid&quot;: {
                &quot;geotile_grid&quot;: {
                  &quot;field&quot;: &quot;my-geo-field&quot;,
                  &quot;precision&quot;: 11,
                  &quot;size&quot;: 65536,
                  &quot;bounds&quot;: {
                    &quot;top_left&quot;: {
                      &quot;lat&quot;: -40.979898069620134,
                      &quot;lon&quot;: -45
                    },
                    &quot;bottom_right&quot;: {
                      &quot;lat&quot;: -66.51326044311186,
                      &quot;lon&quot;: 0
                    }
                  }
                }
              },
              &quot;bounds&quot;: {
                &quot;geo_bounds&quot;: {
                  &quot;field&quot;: &quot;my-geo-field&quot;,
                  &quot;wrap_longitude&quot;: false
                }
              }
            }
          }
          </code></pre>
          <p>The API returns results as a binary Mapbox vector tile.
          Mapbox vector tiles are encoded as Google Protobufs (PBF). By default, the tile contains three layers:</p>
          <ul>
          <li>A <code>hits</code> layer containing a feature for each <code>&lt;field&gt;</code> value matching the <code>geo_bounding_box</code> query.</li>
          <li>An <code>aggs</code> layer containing a feature for each cell of the <code>geotile_grid</code> or <code>geohex_grid</code>. The layer only contains features for cells with matching data.</li>
          <li>A meta layer containing:
          <ul>
          <li>A feature containing a bounding box. By default, this is the bounding box of the tile.</li>
          <li>Value ranges for any sub-aggregations on the <code>geotile_grid</code> or <code>geohex_grid</code>.</li>
          <li>Metadata for the search.</li>
          </ul>
          </li>
          </ul>
          <p>The API only returns features that can display at its zoom level.
          For example, if a polygon feature has no area at its zoom level, the API omits it.
          The API returns errors as UTF-8 encoded JSON.</p>
          <p>IMPORTANT: You can specify several options for this API as either a query parameter or request body parameter.
          If you specify both parameters, the query parameter takes precedence.</p>
          <p><strong>Grid precision for geotile</strong></p>
          <p>For a <code>grid_agg</code> of <code>geotile</code>, you can use cells in the <code>aggs</code> layer as tiles for lower zoom levels.
          <code>grid_precision</code> represents the additional zoom levels available through these cells. The final precision is computed by as follows: <code>&lt;zoom&gt; + grid_precision</code>.
          For example, if <code>&lt;zoom&gt;</code> is 7 and <code>grid_precision</code> is 8, then the <code>geotile_grid</code> aggregation will use a precision of 15.
          The maximum final precision is 29.
          The <code>grid_precision</code> also determines the number of cells for the grid as follows: <code>(2^grid_precision) x (2^grid_precision)</code>.
          For example, a value of 8 divides the tile into a grid of 256 x 256 cells.
          The <code>aggs</code> layer only contains features for cells with matching data.</p>
          <p><strong>Grid precision for geohex</strong></p>
          <p>For a <code>grid_agg</code> of <code>geohex</code>, Elasticsearch uses <code>&lt;zoom&gt;</code> and <code>grid_precision</code> to calculate a final precision as follows: <code>&lt;zoom&gt; + grid_precision</code>.</p>
          <p>This precision determines the H3 resolution of the hexagonal cells produced by the <code>geohex</code> aggregation.
          The following table maps the H3 resolution for each precision.
          For example, if <code>&lt;zoom&gt;</code> is 3 and <code>grid_precision</code> is 3, the precision is 6.
          At a precision of 6, hexagonal cells have an H3 resolution of 2.
          If <code>&lt;zoom&gt;</code> is 3 and <code>grid_precision</code> is 4, the precision is 7.
          At a precision of 7, hexagonal cells have an H3 resolution of 3.</p>
          <table>
          <thead>
          <tr>
          <th>Precision</th>
          <th>Unique tile bins</th>
          <th>H3 resolution</th>
          <th>Unique hex bins</th>
          <th>Ratio</th>
          </tr>
          </thead>
          <tbody>
          <tr>
          <td>1</td>
          <td>4</td>
          <td>0</td>
          <td>122</td>
          <td>30.5</td>
          </tr>
          <tr>
          <td>2</td>
          <td>16</td>
          <td>0</td>
          <td>122</td>
          <td>7.625</td>
          </tr>
          <tr>
          <td>3</td>
          <td>64</td>
          <td>1</td>
          <td>842</td>
          <td>13.15625</td>
          </tr>
          <tr>
          <td>4</td>
          <td>256</td>
          <td>1</td>
          <td>842</td>
          <td>3.2890625</td>
          </tr>
          <tr>
          <td>5</td>
          <td>1024</td>
          <td>2</td>
          <td>5882</td>
          <td>5.744140625</td>
          </tr>
          <tr>
          <td>6</td>
          <td>4096</td>
          <td>2</td>
          <td>5882</td>
          <td>1.436035156</td>
          </tr>
          <tr>
          <td>7</td>
          <td>16384</td>
          <td>3</td>
          <td>41162</td>
          <td>2.512329102</td>
          </tr>
          <tr>
          <td>8</td>
          <td>65536</td>
          <td>3</td>
          <td>41162</td>
          <td>0.6280822754</td>
          </tr>
          <tr>
          <td>9</td>
          <td>262144</td>
          <td>4</td>
          <td>288122</td>
          <td>1.099098206</td>
          </tr>
          <tr>
          <td>10</td>
          <td>1048576</td>
          <td>4</td>
          <td>288122</td>
          <td>0.2747745514</td>
          </tr>
          <tr>
          <td>11</td>
          <td>4194304</td>
          <td>5</td>
          <td>2016842</td>
          <td>0.4808526039</td>
          </tr>
          <tr>
          <td>12</td>
          <td>16777216</td>
          <td>6</td>
          <td>14117882</td>
          <td>0.8414913416</td>
          </tr>
          <tr>
          <td>13</td>
          <td>67108864</td>
          <td>6</td>
          <td>14117882</td>
          <td>0.2103728354</td>
          </tr>
          <tr>
          <td>14</td>
          <td>268435456</td>
          <td>7</td>
          <td>98825162</td>
          <td>0.3681524172</td>
          </tr>
          <tr>
          <td>15</td>
          <td>1073741824</td>
          <td>8</td>
          <td>691776122</td>
          <td>0.644266719</td>
          </tr>
          <tr>
          <td>16</td>
          <td>4294967296</td>
          <td>8</td>
          <td>691776122</td>
          <td>0.1610666797</td>
          </tr>
          <tr>
          <td>17</td>
          <td>17179869184</td>
          <td>9</td>
          <td>4842432842</td>
          <td>0.2818666889</td>
          </tr>
          <tr>
          <td>18</td>
          <td>68719476736</td>
          <td>10</td>
          <td>33897029882</td>
          <td>0.4932667053</td>
          </tr>
          <tr>
          <td>19</td>
          <td>274877906944</td>
          <td>11</td>
          <td>237279209162</td>
          <td>0.8632167343</td>
          </tr>
          <tr>
          <td>20</td>
          <td>1099511627776</td>
          <td>11</td>
          <td>237279209162</td>
          <td>0.2158041836</td>
          </tr>
          <tr>
          <td>21</td>
          <td>4398046511104</td>
          <td>12</td>
          <td>1660954464122</td>
          <td>0.3776573213</td>
          </tr>
          <tr>
          <td>22</td>
          <td>17592186044416</td>
          <td>13</td>
          <td>11626681248842</td>
          <td>0.6609003122</td>
          </tr>
          <tr>
          <td>23</td>
          <td>70368744177664</td>
          <td>13</td>
          <td>11626681248842</td>
          <td>0.165225078</td>
          </tr>
          <tr>
          <td>24</td>
          <td>281474976710656</td>
          <td>14</td>
          <td>81386768741882</td>
          <td>0.2891438866</td>
          </tr>
          <tr>
          <td>25</td>
          <td>1125899906842620</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.5060018015</td>
          </tr>
          <tr>
          <td>26</td>
          <td>4503599627370500</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.1265004504</td>
          </tr>
          <tr>
          <td>27</td>
          <td>18014398509482000</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.03162511259</td>
          </tr>
          <tr>
          <td>28</td>
          <td>72057594037927900</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.007906278149</td>
          </tr>
          <tr>
          <td>29</td>
          <td>288230376151712000</td>
          <td>15</td>
          <td>569707381193162</td>
          <td>0.001976569537</td>
          </tr>
          </tbody>
          </table>
          <p>Hexagonal cells don't align perfectly on a vector tile.
          Some cells may intersect more than one vector tile.
          To compute the H3 resolution for each precision, Elasticsearch compares the average density of hexagonal bins at each resolution with the average density of tile bins at each zoom level.
          Elasticsearch uses the H3 resolution that is closest to the corresponding geotile density.</p>


        `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-search-mvt>`_

        :param index: Comma-separated list of data streams, indices, or aliases to search
        :param field: Field containing geospatial data to return
        :param zoom: Zoom level for the vector tile to search
        :param x: X coordinate for the vector tile to search
        :param y: Y coordinate for the vector tile to search
        :param aggs: Sub-aggregations for the geotile_grid. It supports the following
            aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats`
            - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank`
            - `stats` - `sum` - `value count` The aggregation names can't start with
            `_mvt_`. The `_mvt_` prefix is reserved for internal aggregations.
        :param buffer: The size, in pixels, of a clipping buffer outside the tile. This
            allows renderers to avoid outline artifacts from geometries that extend past
            the extent of the tile.
        :param exact_bounds: If `false`, the meta layer's feature is the bounding box
            of the tile. If `true`, the meta layer's feature is a bounding box resulting
            from a `geo_bounds` aggregation. The aggregation runs on <field> values that
            intersect the `<zoom>/<x>/<y>` tile with `wrap_longitude` set to `false`.
            The resulting bounding box may be larger than the vector tile.
        :param extent: The size, in pixels, of a side of the tile. Vector tiles are square
            with equal sides.
        :param fields: The fields to return in the `hits` layer. It supports wildcards
            (`*`). This parameter does not support fields with array values. Fields with
            array values may return inconsistent results.
        :param grid_agg: The aggregation used to create a grid for the `field`.
        :param grid_precision: Additional zoom levels available through the aggs layer.
            For example, if `<zoom>` is `7` and `grid_precision` is `8`, you can zoom
            in up to level 15. Accepts 0-8. If 0, results don't include the aggs layer.
        :param grid_type: Determines the geometry type for features in the aggs layer.
            In the aggs layer, each feature represents a `geotile_grid` cell. If `grid,
            each feature is a polygon of the cells bounding box. If `point`, each feature
            is a Point that is the centroid of the cell.
        :param query: The query DSL used to filter documents for the search.
        :param runtime_mappings: Defines one or more runtime fields in the search request.
            These fields take precedence over mapped fields with the same name.
        :param size: The maximum number of features to return in the hits layer. Accepts
            0-10000. If 0, results don't include the hits layer.
        :param sort: Sort the features in the hits layer. By default, the API calculates
            a bounding box for each feature. It sorts features based on this box's diagonal
            length, from longest to shortest.
        :param track_total_hits: The number of hits matching the query to count accurately.
            If `true`, the exact number of hits is returned at the cost of some performance.
            If `false`, the response does not include the total number of hits matching
            the query.
        :param with_labels: If `true`, the hits and aggs layers will contain additional
            point features representing suggested label positions for the original features.
            * `Point` and `MultiPoint` features will have one of the points selected.
            * `Polygon` and `MultiPolygon` features will have a single point generated,
            either the centroid, if it is within the polygon, or another point within
            the polygon selected from the sorted triangle-tree. * `LineString` features
            will likewise provide a roughly central point selected from the triangle-tree.
            * The aggregation results will provide one central point for each aggregation
            bucket. All attributes from the original features will also be copied to
            the new label features. In addition, the new features will be distinguishable
            using the tag `_mvt_label_position`.
        """
        if index in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'index'")
        if field in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'field'")
        if zoom in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'zoom'")
        if x in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'x'")
        if y in SKIP_IN_PATH:
            raise ValueError("Empty value passed for parameter 'y'")
        __path_parts: t.Dict[str, str] = {
            "index": _quote(index),
            "field": _quote(field),
            "zoom": _quote(zoom),
            "x": _quote(x),
            "y": _quote(y),
        }
        __path = f'/{__path_parts["index"]}/_mvt/{__path_parts["field"]}/{__path_parts["zoom"]}/{__path_parts["x"]}/{__path_parts["y"]}'
        __query: t.Dict[str, t.Any] = {}
        __body: t.Dict[str, t.Any] = body if body is not None else {}
        # The 'sort' parameter with a colon can't be encoded to the body.
        if sort is not None and (
            (isinstance(sort, str) and ":" in sort)
            or (
                isinstance(sort, (list, tuple))
                and all(isinstance(_x, str) for _x in sort)
                and any(":" in _x for _x in sort)
            )
        ):
            __query["sort"] = sort
            sort = None
        if error_trace is not None:
            __query["error_trace"] = error_trace
        if filter_path is not None:
            __query["filter_path"] = filter_path
        if human is not None:
            __query["human"] = human
        if pretty is not None:
            __query["pretty"] = pretty
        if not __body:
            if aggs is not None:
                __body["aggs"] = aggs
            if buffer is not None:
                __body["buffer"] = buffer
            if exact_bounds is not None:
                __body["exact_bounds"] = exact_bounds
            if extent is not None:
                __body["extent"] = extent
            if fields is not None:
                __body["fields"] = fields
            if grid_agg is not None:
                __body["grid_agg"] = grid_agg
            if grid_precision is not None:
                __body["grid_precision"] = grid_precision
            if grid_type is not None:
                __body["grid_type"] = grid_type
            if query is not None:
                __body["query"] = query
            if runtime_mappings is not None:
                __body["runtime_mappings"] = runtime_mappings
            if size is not None:
                __body["size"] = size
            if sort is not None:
                __body["sort"] = sort
            if track_total_hits is not None:
                __body["track_total_hits"] = track_total_hits
            if with_labels is not None:
                __body["with_labels"] = with_labels
        if not __body:
            __body = None  # type: ignore[assignment]
        __headers = {"accept": "application/vnd.mapbox-vector-tile"}
        if __body is not None:
            __headers["content-type"] = "application/json"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



