public SearchIdResult<String> search(ProjectMeasuresQuery query, SearchOptions searchOptions) {
    SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder()
      .fetchSource(false)
      .trackTotalHits(true)
      .from(searchOptions.getOffset())
      .size(searchOptions.getLimit());

    AllFilters allFilters = createFilters(query);
    RequestFiltersComputer filtersComputer = createFiltersComputer(searchOptions, allFilters);
    addFacets(searchSourceBuilder, searchOptions, filtersComputer, query);
    addSort(query, searchSourceBuilder);

    filtersComputer.getQueryFilters().ifPresent(searchSourceBuilder::query);
    filtersComputer.getPostFilters().ifPresent(searchSourceBuilder::postFilter);
    SearchResponse response = client.search(EsClient.prepareSearch(TYPE_PROJECT_MEASURES.getMainType())
      .source(searchSourceBuilder));
    return new SearchIdResult<>(response, id -> id, system2.getDefaultTimeZone().toZoneId());
  }
@Test
  public void return_correct_number_of_total_if_exceeds_index_max_results() {
    index(IntStream.range(0, 12_000)
      .mapToObj(operand -> newDoc(ComponentTesting.newPrivateProjectDto()))
      .toArray(ProjectMeasuresDoc[]::new));

    ProjectMeasuresQuery query = new ProjectMeasuresQuery();
    SearchIdResult<String> result = underTest.search(query, new SearchOptions());
    assertThat(result.getTotal()).isEqualTo(12_000);
  }