# Empty search response intermittently for same query

**URL:** https://forum.opensearch.org/t/empty-search-response-intermittently-for-same-query/10793
**Category:** OpenSearch
**Created:** [September 1, 2022, 11:52am UTC](https://forum.opensearch.org/t/empty-search-response-intermittently-for-same-query/10793 "2022-09-01T11:52:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cicada](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cicada](https://forum.opensearch.org/u/cicada)
#### Post date: [September 1, 2022, 11:52am UTC](https://forum.opensearch.org/t/empty-search-response-intermittently-for-same-query/10793/1 "2022-09-01T11:52:17Z")

</div>

Hi,

I’m using Opensearch v1.2 with java-high-level-rest-client in a spring-boot application. And facing an issue intermittently.

So, for the same query sometimes I’m getting an empty response/hits. Whereas when I run the query again it returns the correct documents.

I’m not sure if this is something related to opensearch index settings (using default one) or with java threads. My initial guess was that this might be cause of refreshInterval, but the documents are static and it’s a local instance of opensearch so no modifications to documents are happening.

Here’s the code that executes search, using sync search:

```auto
final SearchRequest searchRequest = new SearchRequest(indices)
                .source(queryBuilderToSearchSourceBuilder(builder, from, size))
                .indicesOptions(buildIndicesOptions());
            log.info("searching {} with {}", Arrays.asList(indices), searchRequest);
            return client.search(searchRequest, RequestOptions.DEFAULT);

```

And buildIndicesOptions function looks like this:

```auto
IndicesOptions buildIndicesOptions() {
        return IndicesOptions.fromOptions(true, false, true, false);
    }

```

Thanks for any help 🙂
