@Test public void query_EndPoints() throws Exception { Map<String, Object> json = Helper.getBigJsonText(20); String fortress = "epFortress"; String company = "epCompany"; String doc = "epDocType"; String user = "******"; Entity entity = Helper.getEntity(company, fortress, user, doc); EntitySearchChange change = new EntitySearchChange(entity); change.setDescription("Test Description"); change.setWhat(json); deleteEsIndex(entity); Thread.sleep(1000); SearchResults searchResults = trackService.createSearchableChange(new EntitySearchChanges(change)); SearchResult searchResult = searchResults.getSearchResults().iterator().next(); Thread.sleep(2000); assertNotNull(searchResult); assertNotNull(searchResult.getSearchKey()); QueryParams qp = new QueryParams(entity.getSegment()); qp.setCompany(company); qp.setSearchText("*"); // Sanity check - there is only one document in the index EsSearchResult queryResult = queryServiceEs.doFdViewSearch(qp); assertEquals(1, queryResult.getResults().size()); assertEquals(entity.getMetaKey(), queryResult.getResults().iterator().next().getMetaKey()); MetaKeyResults metaResults = queryServiceEs.doMetaKeyQuery(qp); assertEquals(1, metaResults.getResults().size()); assertEquals(entity.getMetaKey(), metaResults.getResults().iterator().next()); // Find with just a fortress qp = new QueryParams(entity.getSegment()); qp.setSearchText("description"); queryResult = queryServiceEs.doFdViewSearch(qp); assertEquals(1, queryResult.getResults().size()); assertEquals(entity.getMetaKey(), queryResult.getResults().iterator().next().getMetaKey()); qp = new QueryParams().setCompany(company.toLowerCase()); qp.setSearchText("description"); queryResult = queryServiceEs.doFdViewSearch(qp); assertEquals(1, queryResult.getResults().size()); assertEquals(entity.getMetaKey(), queryResult.getResults().iterator().next().getMetaKey()); qp = new QueryParams(entity.getSegment()); qp.setSearchText("-description"); // Ignore description queryResult = queryServiceEs.doFdViewSearch(qp); assertEquals(0, queryResult.getResults().size()); }