# Percolate Query Issues after Upgrading to Elasticsearch 8.6.2 with REST High-Level Client 7.17.9

**URL:** <https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359>\
**Category:** Elasticsearch\
**Created:** [June 19, 2023, 11:51am UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359 "2023-06-19T11:51:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulysse42](https://avatars.discourse-cdn.com/v4/letter/u/7ab992/32.png) [@ulysse42](https://discuss.elastic.co/u/ulysse42)\
**Post date:** [June 19, 2023, 11:51am UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/1 "2023-06-19T11:51:45Z")

</div>

Hello Elasticsearch community,

I'm currently experiencing an issue with the Percolate Query after upgrading my Elasticsearch version to 8.6.2. I'm still using the REST High-Level Client 7.17.9.

Here's the exception I'm getting: "Elasticsearch exception [type=x\_content\_parse\_exception, reason=[1:40] [percolate] document\_type doesn't support values of type: VALUE\_NULL]"

This exception is raised when running the following piece of code:

```java
public SearchResponse percolate(String percolatorIndex, List<?> queryDocuments) throws IOException {
    // get a list of documents in bytes
    final List<BytesReference> documentBytes = queryDocuments.stream().map(this::convertQueryDocumentToBytes)
            .collect(Collectors.toList());

    // create the percolator query
    final PercolateQueryBuilder percolateQueryBuilder = new PercolateQueryBuilder(QUERY_FIELD,
            documentBytes, XContentType.JSON);

    // create the search request
    final SearchRequest searchRequest = new SearchRequest(percolatorIndex)
            .source(new SearchSourceBuilder().query(percolateQueryBuilder));

    // call the search
    return client.search(searchRequest, RequestOptions.DEFAULT);
}

```

It seems like the document\_type parameter of my request is being set to null:  
source={"query":{"percolate":{"document\_type":null,"field":"query","documents":[{...}]

However, I can't figure out where to change this. I've been going through the code and haven't found any place where the document\_type value is set.

I should also note that this issue arose after I upgraded my Elasticsearch version to 8.6.2. Before the upgrade, this code was working fine.

Does anyone have any ideas or suggestions on how to resolve this? I don't understand what is the use of this document\_type fields, and why it is not set to json instead of null.

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 19, 2023, 12:03pm UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/2 "2023-06-19T12:03:10Z")

</div>

I think you need to upgrade to the new Java Client version 8.6.2 (8.8.1 should work as well and is better).

---

<div class="post-metadata">

**Author:** ![ulysse42](https://avatars.discourse-cdn.com/v4/letter/u/7ab992/32.png) [@ulysse42](https://discuss.elastic.co/u/ulysse42)\
**Post date:** [June 19, 2023, 12:25pm UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/3 "2023-06-19T12:25:51Z")

</div>

I understand that this could be a solution but it wil take us a lot of time. I read that "The High Level Client version 7.16 and higher can communicate with Elasticsearch version 8.x after enabling API compatibility mode" ( [Compatibility | Java REST Client [7.17] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-compatibility.html)) so in theory i could make it work with the client no ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 19, 2023, 12:38pm UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/4 "2023-06-19T12:38:37Z")

</div>

Yes it should be but in general, I'd try to use the same version on both sides.

If you can't, then using this mode should work. If it does not for this API, I'm fearing that could be a bug. May be first upgrade to 7.17.10 although I don't know if this will fix the problem.

@swallez might know...

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [June 19, 2023, 4:45pm UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/5 "2023-06-19T16:45:43Z")

</div>

Document types have been deprecated in version 8, and should ignore them. Except that it still rejects a null value for this ignored setting.

Try using `new PercolateQueryBuilder(QUERY_FIELD, "dummy_type", documentBytes, ContentType.JSON)`

---

<div class="post-metadata">

**Author:** ![ulysse42](https://avatars.discourse-cdn.com/v4/letter/u/7ab992/32.png) [@ulysse42](https://discuss.elastic.co/u/ulysse42)\
**Post date:** [June 20, 2023, 2:16pm UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/6 "2023-06-20T14:16:35Z")

</div>

Thank you very much, it has worked for me!

---

<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:** [July 18, 2023, 2:17pm UTC](https://discuss.elastic.co/t/percolate-query-issues-after-upgrading-to-elasticsearch-8-6-2-with-rest-high-level-client-7-17-9/336359/7 "2023-07-18T14:17:28Z")

</div>

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