Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch 2.11.1
Describe the issue:
Trying to get pagination working for opensearch. Had it working with Elasticsearch but, have moved over to opensearch which apparently implemented this feature in a different way. I am creating a SearchRequest.Builder object after having successfully created a pitId using CreatePitRequest but, getting error when attempting a search with a request as defined below.
final Query query = QueryBuilders.match().field(query_field).query(FieldValue.of(query_field_val)).build().toQuery();
SearchRequest.Builder searchRequest = new SearchRequest.Builder()
.pit(new Pit.Builder().id(pitId).keepAlive(keepAlive.toString()).build())
.size(size)// MAX_QUERY_RESULTS)
.query(query).sort(sort -> sort.field(field -> field.field(sort_field)));
Would appreciate if someone could assist with an example as I wasn’t able to find any utilizing PIT with opensearch for java.
Configuration:
<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>spring-data-opensearch-starter</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-java</artifactId>
<version>2.11.1</version>
</dependency>
Relevant Logs or Screenshots:
org.opensearch.client.opensearch._types.OpenSearchException: Request failed: [x_content_parse_exception] [1:1554] [pit] failed to parse field [keep_alive]