|
|
|
|
@@ -19,11 +19,12 @@ package org.springframework.data.elasticsearch.core;
|
|
|
|
|
import static org.elasticsearch.index.query.QueryBuilders.*;
|
|
|
|
|
import static org.hamcrest.CoreMatchers.*;
|
|
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;
|
|
|
|
|
import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -31,12 +32,32 @@ import java.util.Map;
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
|
import org.skyscreamer.jsonassert.JSONAssert;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.annotation.Id;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.CompletionField;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.Document;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.Field;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.InnerField;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.Mapping;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.MultiField;
|
|
|
|
|
import org.springframework.data.elasticsearch.annotations.Parent;
|
|
|
|
|
import org.springframework.data.elasticsearch.builder.SampleInheritedEntityBuilder;
|
|
|
|
|
import org.springframework.data.elasticsearch.core.completion.Completion;
|
|
|
|
|
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
|
|
|
|
|
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
|
|
|
|
import org.springframework.data.elasticsearch.core.query.SearchQuery;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.*;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.Book;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.CopyToEntity;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.GeoEntity;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.Group;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.NormalizerEntity;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.SampleInheritedEntity;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.SampleTransientEntity;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.SimpleRecursiveEntity;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.StockPrice;
|
|
|
|
|
import org.springframework.data.elasticsearch.entities.User;
|
|
|
|
|
import org.springframework.test.context.ContextConfiguration;
|
|
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
|
|
|
|
|
|
|
@@ -64,30 +85,33 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
elasticsearchTemplate.refresh(SimpleRecursiveEntity.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void testInfiniteLoopAvoidance() throws IOException, JSONException {
|
|
|
|
|
final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\""
|
|
|
|
|
|
|
|
|
|
String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\""
|
|
|
|
|
+ "type\":\"text\",\"index\":false," + "\"analyzer\":\"standard\"}}}}";
|
|
|
|
|
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(SampleTransientEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(SampleTransientEntity.class);
|
|
|
|
|
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseValueFromAnnotationType() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// Given
|
|
|
|
|
final String expected = "{\"price\":{\"properties\":{\"price\":{\"store\":false,\"type\":\"double\"}}}}";
|
|
|
|
|
String expected = "{\"price\":{\"properties\":{\"price\":{\"store\":false,\"type\":\"double\"}}}}";
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(StockPrice.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(StockPrice.class);
|
|
|
|
|
|
|
|
|
|
// Then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-530
|
|
|
|
|
public void shouldAddStockPriceDocumentToIndex() throws IOException {
|
|
|
|
|
public void shouldAddStockPriceDocumentToIndex() {
|
|
|
|
|
|
|
|
|
|
// Given
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
@@ -111,34 +135,31 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
assertThat(entry.getPrice(), is(BigDecimal.valueOf(price)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldCreateMappingForSpecifiedParentType() throws IOException, JSONException {
|
|
|
|
|
final String expected = "{\"mapping\":{\"_parent\":{\"type\":\"parentType\"},\"properties\":{}}}";
|
|
|
|
|
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(MinimalChildEntity.class);
|
|
|
|
|
String expected = "{\"mapping\":{\"_parent\":{\"type\":\"parentType\"},\"properties\":{}}}";
|
|
|
|
|
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(MinimalChildEntity.class);
|
|
|
|
|
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* DATAES-76
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-76
|
|
|
|
|
public void shouldBuildMappingWithSuperclass() throws IOException, JSONException {
|
|
|
|
|
final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\""
|
|
|
|
|
|
|
|
|
|
String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\""
|
|
|
|
|
+ "type\":\"text\",\"index\":false,\"analyzer\":\"standard\"}" + ",\"createdDate\":{\"store\":false,"
|
|
|
|
|
+ "\"type\":\"date\",\"index\":false}}}}";
|
|
|
|
|
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(SampleInheritedEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(SampleInheritedEntity.class);
|
|
|
|
|
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* DATAES-76
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void shouldAddSampleInheritedEntityDocumentToIndex() throws IOException {
|
|
|
|
|
@Test // DATAES-76
|
|
|
|
|
public void shouldAddSampleInheritedEntityDocumentToIndex() {
|
|
|
|
|
|
|
|
|
|
// Given
|
|
|
|
|
|
|
|
|
|
// When
|
|
|
|
|
@@ -156,13 +177,15 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
List<SampleInheritedEntity> result = elasticsearchTemplate.queryForList(searchQuery, SampleInheritedEntity.class);
|
|
|
|
|
// Then
|
|
|
|
|
assertThat(result.size(), is(1));
|
|
|
|
|
|
|
|
|
|
SampleInheritedEntity entry = result.get(0);
|
|
|
|
|
assertThat(entry.getCreatedDate(), is(createdDate));
|
|
|
|
|
assertThat(entry.getMessage(), is(message));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldBuildMappingsForGeoPoint() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
String expected = "{\"geo-test-index\": {\"properties\": {" + "\"pointA\":{\"type\":\"geo_point\"},"
|
|
|
|
|
+ "\"pointB\":{\"type\":\"geo_point\"}," + "\"pointC\":{\"type\":\"geo_point\"},"
|
|
|
|
|
@@ -170,17 +193,15 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping;
|
|
|
|
|
mapping = getMappingBuilder().buildMapping(GeoEntity.class);
|
|
|
|
|
mapping = getMappingBuilder().buildPropertyMapping(GeoEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DATAES-260 - StacOverflow when two reverse relationship.
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-260 - StackOverflow when two reverse relationship.
|
|
|
|
|
public void shouldHandleReverseRelationship() {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
elasticsearchTemplate.createIndex(User.class);
|
|
|
|
|
elasticsearchTemplate.putMapping(User.class);
|
|
|
|
|
@@ -189,21 +210,21 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
// when
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
@Test // DATAES-285
|
|
|
|
|
public void shouldMapBooks() {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
elasticsearchTemplate.createIndex(Book.class);
|
|
|
|
|
elasticsearchTemplate.putMapping(Book.class);
|
|
|
|
|
// when
|
|
|
|
|
// then
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-420
|
|
|
|
|
public void shouldUseBothAnalyzer() {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
elasticsearchTemplate.deleteIndex(Book.class);
|
|
|
|
|
elasticsearchTemplate.createIndex(Book.class);
|
|
|
|
|
@@ -224,7 +245,7 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-492
|
|
|
|
|
public void shouldUseKeywordNormalizer() throws IOException {
|
|
|
|
|
public void shouldUseKeywordNormalizer() {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
elasticsearchTemplate.deleteIndex(NormalizerEntity.class);
|
|
|
|
|
@@ -245,7 +266,7 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-503
|
|
|
|
|
public void shouldUseCopyTo() throws IOException {
|
|
|
|
|
public void shouldUseCopyTo() {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
elasticsearchTemplate.deleteIndex(CopyToEntity.class);
|
|
|
|
|
@@ -259,107 +280,188 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
|
|
|
|
Map fieldLastName = (Map) properties.get("lastName");
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
List<String> copyToValue = Arrays.asList("name");
|
|
|
|
|
List<String> copyToValue = Collections.singletonList("name");
|
|
|
|
|
assertThat(fieldFirstName.get("copy_to"), equalTo(copyToValue));
|
|
|
|
|
assertThat(fieldLastName.get("copy_to"), equalTo(copyToValue));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnId() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true}" + "}}}";
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true}"
|
|
|
|
|
+ "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.IdEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.IdEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnText() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
+ "\"text-property\":{\"store\":false,\"type\":\"text\"}" + "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.TextEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.TextEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnMapping() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
+ "\"mapping-property\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"}" + "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.MappingEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.MappingEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnGeoPoint() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true}," + "\"geopoint-property\":{\"type\":\"geo_point\"}"
|
|
|
|
|
+ "}}}";
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
+ "\"geopoint-property\":{\"type\":\"geo_point\"}" + "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.GeoPointEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.GeoPointEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnCircularEntity() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
+ "\"circular-property\":{\"type\":\"object\",\"properties\":{\"id-property\":{\"store\":false}}}" + "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.CircularEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.CircularEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnCompletion() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
+ "\"completion-property\":{\"type\":\"completion\",\"max_input_length\":100,\"preserve_position_increments\":true,\"preserve_separators\":true,\"search_analyzer\":\"simple\",\"analyzer\":\"simple\"},\"completion-property\":{\"store\":false}"
|
|
|
|
|
+ "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.CompletionEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.CompletionEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test // DATAES-568
|
|
|
|
|
public void shouldUseFieldNameOnMultiField() throws IOException, JSONException {
|
|
|
|
|
|
|
|
|
|
// given
|
|
|
|
|
final String expected = "{\"fieldname-type\":{\"properties\":{"
|
|
|
|
|
+ "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
String expected = "{\"fieldname-type\":{\"properties\":{" + "\"id-property\":{\"type\":\"keyword\",\"index\":true},"
|
|
|
|
|
+ "\"multifield-property\":{\"store\":false,\"type\":\"text\",\"analyzer\":\"whitespace\",\"fields\":{\"prefix\":{\"store\":false,\"type\":\"text\",\"analyzer\":\"stop\",\"search_analyzer\":\"standard\"}}}"
|
|
|
|
|
+ "}}}";
|
|
|
|
|
|
|
|
|
|
// when
|
|
|
|
|
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.MultiFieldEntity.class);
|
|
|
|
|
String mapping = getMappingBuilder().buildPropertyMapping(FieldNameEntity.MultiFieldEntity.class);
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
JSONAssert.assertEquals(expected, mapping, false);
|
|
|
|
|
assertEquals(expected, mapping, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Peter-Josef Meisch
|
|
|
|
|
*/
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
static class FieldNameEntity {
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class IdEntity {
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class TextEntity {
|
|
|
|
|
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
|
|
|
|
|
@Field(name = "text-property", type = FieldType.Text) //
|
|
|
|
|
private String textProperty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class MappingEntity {
|
|
|
|
|
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
|
|
|
|
|
@Field("mapping-property") @Mapping(mappingPath = "/mappings/test-field-analyzed-mappings.json") //
|
|
|
|
|
private byte[] mappingProperty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class GeoPointEntity {
|
|
|
|
|
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
|
|
|
|
|
@Field("geopoint-property") private GeoPoint geoPoint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class CircularEntity {
|
|
|
|
|
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
|
|
|
|
|
@Field(name = "circular-property", type = FieldType.Object, ignoreFields = { "circular-property" }) //
|
|
|
|
|
private CircularEntity circularProperty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class CompletionEntity {
|
|
|
|
|
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
|
|
|
|
|
@Field("completion-property") @CompletionField(maxInputLength = 100) //
|
|
|
|
|
private Completion suggest;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Document(indexName = "fieldname-index", type = "fieldname-type")
|
|
|
|
|
static class MultiFieldEntity {
|
|
|
|
|
|
|
|
|
|
@Id @Field("id-property") private String id;
|
|
|
|
|
|
|
|
|
|
@Field("multifield-property") //
|
|
|
|
|
@MultiField(mainField = @Field(type = FieldType.Text, analyzer = "whitespace"), otherFields = {
|
|
|
|
|
@InnerField(suffix = "prefix", type = FieldType.Text, analyzer = "stop", searchAnalyzer = "standard") }) //
|
|
|
|
|
private String description;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MinimalChildEntity
|
|
|
|
|
*
|
|
|
|
|
* @author Peter-josef Meisch
|
|
|
|
|
*/
|
|
|
|
|
@Document(indexName = "test-index-minimal", type = "mapping")
|
|
|
|
|
static class MinimalChildEntity {
|
|
|
|
|
|
|
|
|
|
@Id private String id;
|
|
|
|
|
|
|
|
|
|
@Parent(type = "parentType") private String parentId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|