IllegalStateException thrown by Gson while encoding Elasticsearch requests

Description

See https://ci.hibernate.org/job/hibernate-search/job/master/462/testReport/junit/org.hibernate.search.documentation.search.projection/ProjectionDslIT(default-default)/lucene_elasticsearch_/

It occurs randomly. Probably caused by concurrent access to a Gson object.
I suspect it's somehow related to changes in HSEARCH-3084.
Maybe we've been using Gson wrong all along? Maybe it's not supposed to be used concurrently?

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure