Add query timeout in Elastic native query - springboot

painless_elastic
Tue, 26 Jul 2022 14:11:45 +0000
Elasticsearch

How can I add query timeout in the below Native Seach Query?

final QueryBuilder contentTagQuery = QueryBuilders.boolQuery()
                .filter( QueryBuilders.termQuery("tenantId" , "en"));
NativeSearchQuery query = new NativeSearchQuery(contentTagQuery);
query.setMaxResults(1);

SearchHits<Content> searchHits =
         elasticsearchOperations.search(
                        query, Content.class,
                        IndexCoordinates.of("index"));

2 posts - 2 participants