From 4e0cbb8966c155d326594a3b67dc78f1c9bd582d Mon Sep 17 00:00:00 2001 From: Mohsin Husen Date: Tue, 16 Feb 2016 16:07:36 +0000 Subject: [PATCH] DATAES-211 changes in AliasRequest fix tests due to changes in mapping, geo point, alias etc --- .../core/CriteriaFilterProcessor.java | 6 +- .../core/ElasticsearchOperations.java | 6 +- .../core/ElasticsearchTemplate.java | 103 ++++++++---------- .../data/elasticsearch/core/AliasTests.java | 67 +++++++----- .../core/ElasticsearchTemplateTests.java | 4 +- .../core/MappingBuilderTests.java | 10 +- .../geo/ElasticsearchTemplateGeoTests.java | 6 +- .../SimpleElasticsearchRepositoryTests.java | 3 +- 8 files changed, 100 insertions(+), 105 deletions(-) diff --git a/src/main/java/org/springframework/data/elasticsearch/core/CriteriaFilterProcessor.java b/src/main/java/org/springframework/data/elasticsearch/core/CriteriaFilterProcessor.java index 3ee30937a..c654e9659 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/CriteriaFilterProcessor.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/CriteriaFilterProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,9 @@ * CriteriaFilterProcessor * * @author Franck Marchand + * @author Mohsin Husen + * @author Artur Konczak + * */ class CriteriaFilterProcessor { @@ -105,6 +108,7 @@ private QueryBuilder processCriteriaEntry(OperationKey key, Object value, String } QueryBuilder filter = null; + //todo : expose more option for GeoPoint i.e GeoDistance.PLANE or GeoDistance.ARC switch (key) { case WITHIN: { GeoDistanceQueryBuilder geoDistanceQueryBuilder = QueryBuilders.geoDistanceQuery(fieldName); diff --git a/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchOperations.java b/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchOperations.java index aee9be5db..cd2f00656 100755 --- a/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchOperations.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.data.elasticsearch.core; import org.elasticsearch.action.update.UpdateResponse; +import org.elasticsearch.cluster.metadata.AliasMetaData; import org.springframework.data.domain.Page; import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter; import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity; @@ -25,7 +26,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Set; /** * ElasticsearchOperations @@ -588,7 +588,7 @@ public interface ElasticsearchOperations { * @param indexName * @return */ - Set queryForAlias(String indexName); + List queryForAlias(String indexName); T query(SearchQuery query, ResultsExtractor resultsExtractor); diff --git a/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java b/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java index 81150dc4f..00bd94789 100755 --- a/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import org.apache.commons.collections.CollectionUtils; import org.elasticsearch.action.ListenableActionFuture; -import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; +import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; @@ -57,13 +57,13 @@ import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.metadata.AliasAction; +import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.query.MoreLikeThisQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.script.Script; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; import org.elasticsearch.search.highlight.HighlightBuilder; @@ -642,6 +642,7 @@ public String delete(Class clazz, String id) { @Override public void delete(DeleteQuery deleteQuery, Class clazz) { + //TODO : clean up expose parameter for scan and scroll String iName = deleteQuery.getIndex(); String tName = deleteQuery.getType(); if(clazz!=null){ @@ -656,37 +657,46 @@ public void delete(DeleteQuery deleteQuery, Class clazz) { SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(deleteQuery.getQuery()) .withIndices(indexName) .withTypes(typeName) - //TOD: ako - check that id is all the time avaialable - //.withFields("_id") .withPageable(new PageRequest(0, 1000)) .build(); final String scrollId = scan(searchQuery, 10000, true); final BulkRequestBuilder bulkRequestBuilder = client.prepareBulk(); - boolean hasMoreRecords = true; - while (hasMoreRecords) { - final Page scroll = scroll(scrollId, 10000L, new SearchResultMapper() { + List ids = new ArrayList(); + boolean hasRecords = true; + while (hasRecords) { + Page page = scroll(scrollId, 5000, new SearchResultMapper() { @Override public FacetedPage mapResults(SearchResponse response, Class clazz, Pageable pageable) { - boolean hasItems = false; + List result = new ArrayList(); for (SearchHit searchHit : response.getHits()) { - hasItems = true; - bulkRequestBuilder.add(client.prepareDelete(indexName, typeName, searchHit.getId())); + String id = searchHit.getId(); + result.add(id); } - if(hasItems){ - return new FacetedPageImpl((List)Arrays.asList(new Object())); + + if (result.size() > 0) { + return new FacetedPageImpl((List) result); } return null; } }); - if (scroll == null) { - hasMoreRecords = false; + if (page != null && page.getContent().size() > 0) { + ids.addAll(page.getContent()); + } else { + hasRecords = false; } } - if(bulkRequestBuilder.numberOfActions()>0) { + + for(String id : ids) { + bulkRequestBuilder.add(client.prepareDelete(indexName, typeName, id)); + } + + if(bulkRequestBuilder.numberOfActions() > 0) { bulkRequestBuilder.execute().actionGet(); } + + refresh(indexName, false); } @Override @@ -795,7 +805,7 @@ public Page scroll(String scrollId, long scrollTimeInMillis, SearchResult @Override public Page moreLikeThis(MoreLikeThisQuery query, Class clazz) { - int startRecord = 0; + //todo : clean up ElasticsearchPersistentEntity persistentEntity = getPersistentEntityFor(clazz); String indexName = isNotBlank(query.getIndexName()) ? query.getIndexName() : persistentEntity.getIndexName(); String type = isNotBlank(query.getType()) ? query.getType() : persistentEntity.getIndexType(); @@ -805,60 +815,35 @@ public Page moreLikeThis(MoreLikeThisQuery query, Class clazz) { Assert.notNull(query.getId(), "No document id defined for MoreLikeThisQuery"); final MoreLikeThisQueryBuilder.Item item = new MoreLikeThisQueryBuilder.Item(indexName, type, query.getId()); - final NativeSearchQuery build = new NativeSearchQueryBuilder().withQuery(moreLikeThisQuery().addLikeItem(item)).build(); - return queryForPage(build,clazz); - - //TODO: Mohins - set all other params for moreLikeThis -/* MoreLikeThisRequestBuilder requestBuilder = client.prepareMoreLikeThis(indexName, type, query.getId()); - - if (query.getPageable() != null) { - startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize(); - requestBuilder.setSearchSize(query.getPageable().getPageSize()); - } - requestBuilder.setSearchFrom(startRecord); + MoreLikeThisQueryBuilder moreLikeThisQueryBuilder = moreLikeThisQuery().addLikeItem(item); - if (isNotEmpty(query.getSearchIndices())) { - requestBuilder.setSearchIndices(toArray(query.getSearchIndices())); - } - if (isNotEmpty(query.getSearchTypes())) { - requestBuilder.setSearchTypes(toArray(query.getSearchTypes())); - } - if (isNotEmpty(query.getFields())) { - requestBuilder.setField(toArray(query.getFields())); - } - if (isNotBlank(query.getRouting())) { - requestBuilder.setRouting(query.getRouting()); - } - if (query.getPercentTermsToMatch() != null) { - requestBuilder.setPercentTermsToMatch(query.getPercentTermsToMatch()); - } if (query.getMinTermFreq() != null) { - requestBuilder.setMinTermFreq(query.getMinTermFreq()); + moreLikeThisQueryBuilder.minTermFreq(query.getMinTermFreq()); } if (query.getMaxQueryTerms() != null) { - requestBuilder.maxQueryTerms(query.getMaxQueryTerms()); + moreLikeThisQueryBuilder.maxQueryTerms(query.getMaxQueryTerms()); } if (isNotEmpty(query.getStopWords())) { - requestBuilder.setStopWords(toArray(query.getStopWords())); + moreLikeThisQueryBuilder.stopWords(toArray(query.getStopWords())); } if (query.getMinDocFreq() != null) { - requestBuilder.setMinDocFreq(query.getMinDocFreq()); + moreLikeThisQueryBuilder.minDocFreq(query.getMinDocFreq()); } if (query.getMaxDocFreq() != null) { - requestBuilder.setMaxDocFreq(query.getMaxDocFreq()); + moreLikeThisQueryBuilder.maxDocFreq(query.getMaxDocFreq()); } if (query.getMinWordLen() != null) { - requestBuilder.setMinWordLen(query.getMinWordLen()); + moreLikeThisQueryBuilder.minWordLength(query.getMinWordLen()); } if (query.getMaxWordLen() != null) { - requestBuilder.setMaxWordLen(query.getMaxWordLen()); + moreLikeThisQueryBuilder.maxWordLength(query.getMaxWordLen()); } if (query.getBoostTerms() != null) { - requestBuilder.setBoostTerms(query.getBoostTerms()); + moreLikeThisQueryBuilder.boostTerms(query.getBoostTerms()); } - SearchResponse response = getSearchResponse(requestBuilder.execute()); - return resultsMapper.mapResults(response, clazz, query.getPageable());*/ + final NativeSearchQuery build = new NativeSearchQueryBuilder().withQuery(moreLikeThisQueryBuilder).build(); + return queryForPage(build,clazz); } private SearchResponse doSearch(SearchRequestBuilder searchRequest, SearchQuery searchQuery) { @@ -1052,11 +1037,13 @@ private IndexRequestBuilder prepareIndex(IndexQuery query) { } } + //TODO : remove or waitForOperation @Override public void refresh(String indexName, boolean waitForOperation) { client.admin().indices().refresh(refreshRequest(indexName)).actionGet(); } + //TODO : remove or waitForOperation @Override public void refresh(Class clazz, boolean waitForOperation) { ElasticsearchPersistentEntity persistentEntity = getPersistentEntityFor(clazz); @@ -1092,13 +1079,9 @@ public Boolean removeAlias(AliasQuery query) { } @Override - public Set queryForAlias(String indexName) { - ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest() - .routingTable(true).nodes(true).indices(indexName); - //TODO: ako check how to find aliases for index -/* Iterator iterator = client.admin().cluster().state(clusterStateRequest).actionGet().getState().getMetaData().aliases().keysIt(); - return newHashSet(iterator);*/ - return null; + public List queryForAlias(String indexName) { + return client.admin().indices().getAliases(new GetAliasesRequest().indices(indexName)) + .actionGet().getAliases().get(indexName); } @Override diff --git a/src/test/java/org/springframework/data/elasticsearch/core/AliasTests.java b/src/test/java/org/springframework/data/elasticsearch/core/AliasTests.java index 818dc5e55..a3b01419f 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/AliasTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/AliasTests.java @@ -1,5 +1,5 @@ /* -* Copyright 2014-2015 the original author or authors. +* Copyright 2014-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,10 @@ import static org.elasticsearch.index.query.QueryBuilders.*; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; - import java.util.HashMap; +import java.util.List; import java.util.Map; -import java.util.Set; - +import org.elasticsearch.cluster.metadata.AliasMetaData; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -40,7 +39,8 @@ @ContextConfiguration("classpath:elasticsearch-template-test.xml") public class AliasTests { - private static final String INDEX_NAME = "test-alias-index"; + private static final String INDEX_NAME_1 = "test-alias-index-1"; + private static final String INDEX_NAME_2 = "test-alias-index-2"; private static final String TYPE_NAME = "test-alias-type"; @Autowired @@ -54,9 +54,13 @@ public void before() { settings.put("index.number_of_shards", "2"); settings.put("index.store.type", "fs"); - elasticsearchTemplate.deleteIndex(INDEX_NAME); - elasticsearchTemplate.createIndex(INDEX_NAME, settings); - elasticsearchTemplate.refresh(INDEX_NAME, true); + elasticsearchTemplate.deleteIndex(INDEX_NAME_1); + elasticsearchTemplate.createIndex(INDEX_NAME_1, settings); + elasticsearchTemplate.refresh(INDEX_NAME_1, true); + + elasticsearchTemplate.deleteIndex(INDEX_NAME_2); + elasticsearchTemplate.createIndex(INDEX_NAME_2, settings); + elasticsearchTemplate.refresh(INDEX_NAME_2, true); } @Test @@ -64,34 +68,33 @@ public void shouldAddAlias() { // given String aliasName = "test-alias"; AliasQuery aliasQuery = new AliasBuilder() - .withIndexName(INDEX_NAME) + .withIndexName(INDEX_NAME_1) .withAliasName(aliasName).build(); // when elasticsearchTemplate.addAlias(aliasQuery); // then - Set aliases = elasticsearchTemplate.queryForAlias(INDEX_NAME); + List aliases = elasticsearchTemplate.queryForAlias(INDEX_NAME_1); assertThat(aliases, is(notNullValue())); - assertThat(aliases.contains(aliasName), is(true)); + assertThat(aliases.get(0).alias(), is(aliasName)); } @Test public void shouldRemoveAlias() { // given - String indexName = INDEX_NAME; + String indexName = INDEX_NAME_1; String aliasName = "test-alias"; AliasQuery aliasQuery = new AliasBuilder() .withIndexName(indexName) .withAliasName(aliasName).build(); // when elasticsearchTemplate.addAlias(aliasQuery); - Set aliases = elasticsearchTemplate.queryForAlias(indexName); + List aliases = elasticsearchTemplate.queryForAlias(indexName); assertThat(aliases, is(notNullValue())); - assertThat(aliases.contains(aliasName), is(true)); + assertThat(aliases.get(0).alias(), is(aliasName)); // then elasticsearchTemplate.removeAlias(aliasQuery); aliases = elasticsearchTemplate.queryForAlias(indexName); - assertThat(aliases, is(notNullValue())); - assertThat(aliases.size(), is(0)); + assertThat(aliases, is(nullValue())); } /* @@ -100,7 +103,7 @@ public void shouldRemoveAlias() { @Test public void shouldAddAliasWithGivenRoutingValue() { //given - String indexName = INDEX_NAME; + String indexName = INDEX_NAME_1; String alias = "test-alias"; AliasQuery aliasQuery = new AliasBuilder() @@ -124,15 +127,17 @@ public void shouldAddAliasWithGivenRoutingValue() { .build(); elasticsearchTemplate.index(indexQuery); - elasticsearchTemplate.refresh(INDEX_NAME, true); + elasticsearchTemplate.refresh(INDEX_NAME_1, true); SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery()) .withIndices(alias).withTypes(TYPE_NAME).build(); long count = elasticsearchTemplate.count(query); //then - Set aliases = elasticsearchTemplate.queryForAlias(INDEX_NAME); + List aliases = elasticsearchTemplate.queryForAlias(INDEX_NAME_1); assertThat(aliases, is(notNullValue())); - assertThat(aliases.contains(alias), is(true)); + assertThat(aliases.get(0).alias(), is(alias)); + assertThat(aliases.get(0).searchRouting(), is("0")); + assertThat(aliases.get(0).indexRouting(), is("0")); assertThat(count, is(1L)); //cleanup @@ -153,12 +158,12 @@ public void shouldAddAliasForVariousRoutingValues() { String alias2 = "test-alias-2"; AliasQuery aliasQuery1 = new AliasBuilder() - .withIndexName(INDEX_NAME) + .withIndexName(INDEX_NAME_1) .withAliasName(alias1) .withIndexRouting("0").build(); AliasQuery aliasQuery2 = new AliasBuilder() - .withIndexName(INDEX_NAME) + .withIndexName(INDEX_NAME_2) .withAliasName(alias2) .withSearchRouting("1").build(); @@ -179,15 +184,17 @@ public void shouldAddAliasForVariousRoutingValues() { elasticsearchTemplate.index(indexQuery); - SearchQuery query = new NativeSearchQueryBuilder().withQuery(matchAllQuery()) - .withIndices(alias2).withTypes(TYPE_NAME).build(); - long count = elasticsearchTemplate.count(query, SampleEntity.class); + // then - Set aliases = elasticsearchTemplate.queryForAlias(INDEX_NAME); - assertThat(aliases, is(notNullValue())); - assertThat(aliases.contains(alias1), is(true)); - assertThat(aliases.contains(alias2), is(true)); - assertThat(count, is(0L)); + List responseAlias1 = elasticsearchTemplate.queryForAlias(INDEX_NAME_1); + assertThat(responseAlias1, is(notNullValue())); + assertThat(responseAlias1.get(0).alias(), is(alias1)); + assertThat(responseAlias1.get(0).indexRouting(), is("0")); + + List responseAlias2 = elasticsearchTemplate.queryForAlias(INDEX_NAME_2); + assertThat(responseAlias2, is(notNullValue())); + assertThat(responseAlias2.get(0).alias(), is(alias2)); + assertThat(responseAlias2.get(0).searchRouting(), is("1")); //cleanup elasticsearchTemplate.removeAlias(aliasQuery1); diff --git a/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java b/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java index 585474fb2..4f98d35ce 100755 --- a/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -338,6 +338,8 @@ public void shouldDeleteDocumentForGivenQuery() { IndexQuery indexQuery = getIndexQuery(sampleEntity); elasticsearchTemplate.index(indexQuery); + elasticsearchTemplate.refresh(SampleEntity.class, true); + // when DeleteQuery deleteQuery = new DeleteQuery(); deleteQuery.setQuery(termQuery("id", documentId)); diff --git a/src/test/java/org/springframework/data/elasticsearch/core/MappingBuilderTests.java b/src/test/java/org/springframework/data/elasticsearch/core/MappingBuilderTests.java index 1b8912d9e..84a0b62f5 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/MappingBuilderTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/MappingBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,8 +60,8 @@ public void shouldNotFailOnCircularReference() { @Test public void testInfiniteLoopAvoidance() throws IOException { final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\"" + - "type\":\"string\",\"index\":\"not_analyzed\",\"search_analyzer\":\"standard\"," + - "\"index_analyzer\":\"standard\"}}}}"; + "type\":\"string\",\"index\":\"not_analyzed\"," + + "\"analyzer\":\"standard\"}}}}"; XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleTransientEntity.class, "mapping", "id", null); assertThat(xContentBuilder.string(), is(expected)); @@ -115,8 +115,8 @@ public void shouldCreateMappingForSpecifiedParentType() throws IOException { @Test public void shouldBuildMappingWithSuperclass() throws IOException { final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\"" + - "type\":\"string\",\"index\":\"not_analyzed\",\"search_analyzer\":\"standard\"," + - "\"index_analyzer\":\"standard\"},\"createdDate\":{\"store\":false," + + "type\":\"string\",\"index\":\"not_analyzed\",\"analyzer\":\"standard\"}" + + ",\"createdDate\":{\"store\":false," + "\"type\":\"date\",\"index\":\"not_analyzed\"}}}}"; XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleInheritedEntity.class, "mapping", "id", null); diff --git a/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java b/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java index 02985cd87..4ce6860d8 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/geo/ElasticsearchTemplateGeoTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,7 +146,7 @@ public void shouldFindStringAnnotatedGeoMarkersInRangeForGivenCriteriaQuery() { List geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, LocationMarkerEntity.class); //then - assertThat(geoAuthorsForGeoCriteria.size(), is(3)); + assertThat(geoAuthorsForGeoCriteria.size(), is(2)); } @Test @@ -180,7 +180,7 @@ public void shouldFindAnnotatedGeoMarkersInRangeForGivenCriteriaQueryUsingGeohas //given loadAnnotationBaseEntities(); CriteriaQuery geoLocationCriteriaQuery = new CriteriaQuery( - new Criteria("locationAsArray").within("u1044", "1km")); + new Criteria("locationAsArray").within("u1044", "3km")); //when List geoAuthorsForGeoCriteria = elasticsearchTemplate.queryForList(geoLocationCriteriaQuery, LocationMarkerEntity.class); diff --git a/src/test/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepositoryTests.java b/src/test/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepositoryTests.java index 73e16c1b1..50ddc85ad 100644 --- a/src/test/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepositoryTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import java.util.List; import com.google.common.collect.Lists; -import org.apache.lucene.util.CollectionUtil; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith;