ElasticsearchHelper { public String getSearchIndexType(final String indexName, final String bdefActiveIndex, final String tagActiveIndex) { String searchIndexType; if (indexName.equals(bdefActiveIndex)) { searchIndexType = SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name(); } else if (indexName.equals(tagActiveIndex)) { searchIndexType = SearchIndexTypeEntity.SearchIndexTypes.TAG.name(); } else { throw new IllegalStateException(String .format("Search result index name \"%s\" does not match any of the active search indexes. bdefActiveIndex=%s tagActiveIndex=%s", indexName, bdefActiveIndex, tagActiveIndex)); } return searchIndexType; }  SearchRequestBuilder addFacetFieldAggregations(Set<String> facetFieldsList, SearchRequestBuilder searchRequestBuilder); BoolQueryBuilder addIndexSearchFilterBooleanClause(List<IndexSearchFilter> indexSearchFilters, String bdefActiveIndex, String tagActiveIndex); List<ResultTypeIndexSearchResponseDto> getResultTypeIndexSearchResponseDto(SearchResponse searchResponse); List<TagTypeIndexSearchResponseDto> getTagTagIndexSearchResponseDto(SearchResponse searchResponse); List<TagTypeIndexSearchResponseDto> getNestedTagTagIndexSearchResponseDto(SearchResponse searchResponse); List<Facet> getFacetsResponse(ElasticsearchResponseDto elasticsearchResponseDto, final String bdefActiveIndex, final String tagActiveIndex); Terms getAggregation(SearchResponse searchResponse, String aggregationName); Terms getNestedAggregation(SearchResponse searchResponse, String nestedAggregationName, String subAggregationName); String getSearchIndexType(final String indexName, final String bdefActiveIndex, final String tagActiveIndex); static final String DISPLAY_NAME_SOURCE; static final String NESTED_BDEFTAGS_PATH; static final String TAGTYPE_CODE_FIELD_TAG_INDEX; static final String TAGTYPE_NAME_FIELD_TAG_INDEX; static final String TAG_CODE_FIELD_TAG_INDEX; static final String TAG_NAME_FIELD_TAG_INDEX; static final String BDEF_TAGTYPE_CODE_FIELD; static final String BDEF_TAGTYPE_NAME_FIELD; static final String BDEF_TAG_CODE_FIELD; static final String BDEF_TAG_NAME_FIELD; static final String TAG_TAG_CODE_FIELD; static final String TAG_TAGTYPE_CODE_FIELD; static final String TAG_FACET_AGGS; static final String TAGTYPE_CODE_AGGREGATION; static final String TAGTYPE_NAME_AGGREGATION; static final String TAG_CODE_AGGREGATION; static final String TAG_NAME_AGGREGATION; static final String TAG_FACET; static final String RESULT_TYPE_FACET; static final String TAG_TYPE_FACET_AGGS; static final String RESULT_TYPE_AGGS; static final String RESULT_TYPE_FIELD; }
@Test public void testGetSearchIndexType() { assertEquals(SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name(), elasticsearchHelper .getSearchIndexType(BUSINESS_OBJECT_DEFINITION_SEARCH_INDEX_NAME, BUSINESS_OBJECT_DEFINITION_SEARCH_INDEX_NAME, TAG_SEARCH_INDEX_NAME)); assertEquals(SearchIndexTypeEntity.SearchIndexTypes.TAG.name(), elasticsearchHelper.getSearchIndexType(TAG_SEARCH_INDEX_NAME, BUSINESS_OBJECT_DEFINITION_SEARCH_INDEX_NAME, TAG_SEARCH_INDEX_NAME)); try { elasticsearchHelper.getSearchIndexType(SEARCH_INDEX_NAME, BUSINESS_OBJECT_DEFINITION_SEARCH_INDEX_NAME, TAG_SEARCH_INDEX_NAME); } catch (IllegalStateException e) { assertEquals(String.format("Search result index name \"%s\" does not match any of the active search indexes. bdefActiveIndex=%s tagActiveIndex=%s", SEARCH_INDEX_NAME, BUSINESS_OBJECT_DEFINITION_SEARCH_INDEX_NAME, TAG_SEARCH_INDEX_NAME), e.getMessage()); } }