# Vector Tile (SearchMvt) issues - .NET client

**URL:** <https://discuss.elastic.co/t/vector-tile-searchmvt-issues-net-client/358258>\
**Category:** Elasticsearch\
**Created:** [April 26, 2024, 5:22am UTC](https://discuss.elastic.co/t/vector-tile-searchmvt-issues-net-client/358258 "2024-04-26T05:22:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jarrod](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@Jarrod](https://discuss.elastic.co/u/Jarrod)\
**Post date:** [April 26, 2024, 5:22am UTC](https://discuss.elastic.co/t/vector-tile-searchmvt-issues-net-client/358258/1 "2024-04-26T05:22:18Z")

</div>

This is related to a previous topic I raised: [Elastic.Clients.Elasticsearch .NET client - calling Vector tile search API](https://discuss.elastic.co/t/elastic-clients-elasticsearch-net-client-calling-vector-tile-search-api/341422)

I am attempting to update to the latest version of Elastic.Clients.Elasticsearch (v8.13.8).

As the SearchMvt now appears to be supported I can call it with proper typing and not have to use the low level client.

Here is my code

```auto
            var result = await _elasticClientProvider.Client.SearchMvtAsync(
                index, "geometry", zoom, x, y, 
                request =>
                {
                    request.Query(boolQuery)
                        .Fields(fields)
                        .GridPrecision(0)
                        .TrackTotalHits(new TrackHits(false))
                    .RequestConfiguration(configuration => configuration
                        .ContentType("application/vnd.mapbox-vector-tile")
                        .Accept("application/vnd.elasticsearch+json"));
                }, ct);

            return result.ApiCallDetails.ResponseBodyInBytes;

```

Which returns an error with this message:

```auto
Unsuccessful (406) low level call on POST: /my-index/_mvt/geometry/2/0/1?pretty=true&error_trace=true
 Exception: Request failed to execute. Call: Status code 406 from: POST /my-index/_mvt/geometry/2/0/1?pretty=true&error_trace=true. ServerError: Type: Reason: "Content-Type header [application/vnd.mapbox-vector-tile] is not supported"

```

Ok so I will reverse the settings, and use mapbox-vector-tile in the Accept header, like what happened in the previous topic:

```auto
         .RequestConfiguration(configuration => configuration
                        .Accept("application/vnd.mapbox-vector-tile")
                        .ContentType("application/vnd.elasticsearch+json"));

```

```auto
# Audit exception in step 1 BadResponse:
System.Text.Json.JsonException: '0x1A' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonReaderException: '0x1A' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.

```

Which makes sense, as the JSON serializer wouldn't be able to read the returned binary.

However I can't set the Content-Type to "application/vnd.mapbox-vector-tile".  
It always says not supported 406, like my first error.

Adding `SearchMvtAsync<BytesResponse>` doesn't seem to do anything.

Assistance appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 24, 2024, 5:23am UTC](https://discuss.elastic.co/t/vector-tile-searchmvt-issues-net-client/358258/2 "2024-05-24T05:23:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
