DATAES-568 - MappingBuilder must use the @Field annotation's name attribute.

Original pull request: #281.
This commit is contained in:
P.J. Meisch
2019-04-25 21:50:39 +02:00
committed by Mark Paluch
parent e5c514e385
commit 66b77ecb75
13 changed files with 559 additions and 285 deletions

View File

@@ -50,8 +50,8 @@ public class ElasticsearchRestTemplateTests extends ElasticsearchTemplateTests {
// when
IndexRequest indexRequest = new IndexRequest();
indexRequest.source("{}", XContentType.JSON);
UpdateQuery updateQuery = new UpdateQueryBuilder().withId(randomNumeric(5))
.withClass(SampleEntity.class).withIndexRequest(indexRequest).build();
UpdateQuery updateQuery = new UpdateQueryBuilder().withId(randomNumeric(5)).withClass(SampleEntity.class)
.withIndexRequest(indexRequest).build();
elasticsearchTemplate.update(updateQuery);
}
}

View File

@@ -90,8 +90,8 @@ import org.springframework.data.util.CloseableIterator;
* @author Peter Nowak
* @author Ivan Greene
* @author Dmitriy Yakovlev
* @author Peter-Josef Meisch
*/
@Ignore
public class ElasticsearchTemplateTests {
@@ -128,6 +128,8 @@ public class ElasticsearchTemplateTests {
@Before
public void before() {
deleteIndices();
elasticsearchTemplate.createIndex(SampleEntity.class);
elasticsearchTemplate.putMapping(SampleEntity.class);
@@ -137,7 +139,10 @@ public class ElasticsearchTemplateTests {
@After
public void after() {
deleteIndices();
}
private void deleteIndices() {
elasticsearchTemplate.deleteIndex(SampleEntity.class);
elasticsearchTemplate.deleteIndex(SampleEntityUUIDKeyed.class);
elasticsearchTemplate.deleteIndex(UseServerConfigurationEntity.class);

View File

@@ -21,7 +21,6 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.springframework.data.elasticsearch.utils.IndexBuilder.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;
@@ -29,25 +28,15 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.xcontent.XContentBuilder;
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.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.builder.SampleInheritedEntityBuilder;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.SearchQuery;
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.MinimalEntity;
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.data.elasticsearch.entities.*;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -59,19 +48,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Nordine Bittich
* @author Don Wellington
* @author Sascha Woo
* @author Peter-Josef Meisch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:elasticsearch-template-test.xml")
public class MappingBuilderTests {
public class MappingBuilderTests extends MappingContextBaseTests {
@Autowired private ElasticsearchTemplate elasticsearchTemplate;
private String xContentBuilderToString(XContentBuilder builder) {
builder.close();
ByteArrayOutputStream bos = (ByteArrayOutputStream) builder.getOutputStream();
return bos.toString();
}
@Test
public void shouldNotFailOnCircularReference() {
elasticsearchTemplate.deleteIndex(SimpleRecursiveEntity.class);
@@ -81,24 +65,25 @@ public class MappingBuilderTests {
}
@Test
public void testInfiniteLoopAvoidance() throws IOException {
public void testInfiniteLoopAvoidance() throws IOException, JSONException {
final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\""
+ "type\":\"text\",\"index\":false," + "\"analyzer\":\"standard\"}}}}";
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleTransientEntity.class, "mapping", "id", null);
assertThat(xContentBuilderToString(xContentBuilder), is(expected));
String mapping = getMappingBuilder().buildMapping(SampleTransientEntity.class);
JSONAssert.assertEquals(expected, mapping, false);
}
@Test
public void shouldUseValueFromAnnotationType() throws IOException {
public void shouldUseValueFromAnnotationType() throws IOException, JSONException {
// Given
final String expected = "{\"mapping\":{\"properties\":{\"price\":{\"store\":false,\"type\":\"double\"}}}}";
final String expected = "{\"price\":{\"properties\":{\"price\":{\"store\":false,\"type\":\"double\"}}}}";
// When
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(StockPrice.class, "mapping", "id", null);
String mapping = getMappingBuilder().buildMapping(StockPrice.class);
// Then
assertThat(xContentBuilderToString(xContentBuilder), is(expected));
JSONAssert.assertEquals(expected, mapping, false);
}
@Test // DATAES-530
@@ -127,23 +112,26 @@ public class MappingBuilderTests {
}
@Test
public void shouldCreateMappingForSpecifiedParentType() throws IOException {
public void shouldCreateMappingForSpecifiedParentType() throws IOException, JSONException {
final String expected = "{\"mapping\":{\"_parent\":{\"type\":\"parentType\"},\"properties\":{}}}";
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(MinimalEntity.class, "mapping", "id", "parentType");
assertThat(xContentBuilderToString(xContentBuilder), is(expected));
String mapping = getMappingBuilder().buildMapping(MinimalChildEntity.class);
JSONAssert.assertEquals(expected, mapping, false);
}
/*
* DATAES-76
*/
@Test
public void shouldBuildMappingWithSuperclass() throws IOException {
public void shouldBuildMappingWithSuperclass() throws IOException, JSONException {
final String expected = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,\""
+ "type\":\"text\",\"index\":false,\"analyzer\":\"standard\"}" + ",\"createdDate\":{\"store\":false,"
+ "\"type\":\"date\",\"index\":false}}}}";
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleInheritedEntity.class, "mapping", "id", null);
assertThat(xContentBuilderToString(xContentBuilder), is(expected));
String mapping = getMappingBuilder().buildMapping(SampleInheritedEntity.class);
JSONAssert.assertEquals(expected, mapping, false);
}
/*
@@ -174,19 +162,18 @@ public class MappingBuilderTests {
}
@Test
public void shouldBuildMappingsForGeoPoint() throws IOException {
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\"},"
+ "\"pointD\":{\"type\":\"geo_point\"}" + "}}}";
// when
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(GeoEntity.class, "mapping", "id", null);
String mapping;
mapping = getMappingBuilder().buildMapping(GeoEntity.class);
// then
final String result = xContentBuilderToString(xContentBuilder);
assertThat(result, containsString("\"pointA\":{\"type\":\"geo_point\""));
assertThat(result, containsString("\"pointB\":{\"type\":\"geo_point\""));
assertThat(result, containsString("\"pointC\":{\"type\":\"geo_point\""));
assertThat(result, containsString("\"pointD\":{\"type\":\"geo_point\""));
JSONAssert.assertEquals(expected, mapping, false);
}
/**
@@ -276,4 +263,103 @@ public class MappingBuilderTests {
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}" + "}}}";
// when
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.IdEntity.class);
// then
JSONAssert.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},"
+ "\"text-property\":{\"store\":false,\"type\":\"text\"}" + "}}}";
// when
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.TextEntity.class);
// then
JSONAssert.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},"
+ "\"mapping-property\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"}" + "}}}";
// when
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.MappingEntity.class);
// then
JSONAssert.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\"}"
+ "}}}";
// when
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.GeoPointEntity.class);
// then
JSONAssert.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},"
+ "\"circular-property\":{\"type\":\"object\",\"properties\":{\"id-property\":{\"store\":false}}}" + "}}}";
// when
String mapping = getMappingBuilder().buildMapping(FieldNameEntity.CircularEntity.class);
// then
JSONAssert.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},"
+ "\"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);
// then
JSONAssert.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},"
+ "\"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);
// then
JSONAssert.assertEquals(expected, mapping, false);
}
}

View File

@@ -0,0 +1,54 @@
/* Copyright 2019 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.core;
import java.util.Collection;
import java.util.Collections;
import org.springframework.data.elasticsearch.config.ElasticsearchConfigurationSupport;
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter;
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
import org.springframework.data.util.Lazy;
/**
* @author Peter-Josef Meisch
*/
abstract class MappingContextBaseTests {
protected final Lazy<ElasticsearchConverter> elasticsearchConverter = Lazy.of(this::setupElasticsearchConverter);
private ElasticsearchConverter setupElasticsearchConverter() {
return new MappingElasticsearchConverter(setupMappingContext());
}
private SimpleElasticsearchMappingContext setupMappingContext() {
SimpleElasticsearchMappingContext mappingContext = new ElasticsearchConfigurationSupport() {
@Override
protected Collection<String> getMappingBasePackages() {
return Collections.singletonList("org.springframework.data.elasticsearch.entities.mapping");
}
}.elasticsearchMappingContext();
mappingContext.initialize();
return mappingContext;
}
final MappingBuilder getMappingBuilder() {
return new MappingBuilder(elasticsearchConverter.get());
}
}

View File

@@ -2,8 +2,6 @@ package org.springframework.data.elasticsearch.core;
import java.io.IOException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -16,35 +14,32 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* Dynamic templates tests
*
* @author Petr Kukral
* @author Peter-Josef Meisch
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:elasticsearch-template-test.xml")
public class SimpleDynamicTemplatesMappingTests {
public class SimpleDynamicTemplatesMappingTests extends MappingContextBaseTests {
@Test
public void testCorrectDynamicTemplatesMappings() throws IOException {
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleDynamicTemplatesEntity.class,
"test-dynamictemplatestype", "id", null);
String EXPECTED_MAPPING_ONE = "{\"test-dynamictemplatestype\":{\"dynamic_templates\":" +
"[{\"with_custom_analyzer\":{" +
"\"mapping\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"}," +
"\"path_match\":\"names.*\"}}]," +
"\"properties\":{\"names\":{\"type\":\"object\"}}}}";
Assert.assertEquals(EXPECTED_MAPPING_ONE, Strings.toString(xContentBuilder));
String mapping = getMappingBuilder().buildMapping(SampleDynamicTemplatesEntity.class);
String EXPECTED_MAPPING_ONE = "{\"test-dynamictemplatestype\":{\"dynamic_templates\":"
+ "[{\"with_custom_analyzer\":{"
+ "\"mapping\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"},"
+ "\"path_match\":\"names.*\"}}]," + "\"properties\":{\"names\":{\"type\":\"object\"}}}}";
Assert.assertEquals(EXPECTED_MAPPING_ONE, mapping);
}
@Test
public void testCorrectDynamicTemplatesMappingsTwo() throws IOException {
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleDynamicTemplatesEntityTwo.class,
"test-dynamictemplatestype", "id", null);
String EXPECTED_MAPPING_TWO = "{\"test-dynamictemplatestype\":{\"dynamic_templates\":" +
"[{\"with_custom_analyzer\":{" +
"\"mapping\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"}," +
"\"path_match\":\"names.*\"}}," +
"{\"participantA1_with_custom_analyzer\":{" +
"\"mapping\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"}," +
"\"path_match\":\"participantA1.*\"}}]," +
"\"properties\":{\"names\":{\"type\":\"object\"}}}}";
Assert.assertEquals(EXPECTED_MAPPING_TWO, Strings.toString(xContentBuilder));
String mapping = getMappingBuilder().buildMapping(SampleDynamicTemplatesEntityTwo.class);
String EXPECTED_MAPPING_TWO = "{\"test-dynamictemplatestype\":{\"dynamic_templates\":"
+ "[{\"with_custom_analyzer\":{"
+ "\"mapping\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"},"
+ "\"path_match\":\"names.*\"}}," + "{\"participantA1_with_custom_analyzer\":{"
+ "\"mapping\":{\"type\":\"string\",\"analyzer\":\"standard_lowercase_asciifolding\"},"
+ "\"path_match\":\"participantA1.*\"}}]," + "\"properties\":{\"names\":{\"type\":\"object\"}}}}";
Assert.assertEquals(EXPECTED_MAPPING_TWO, mapping);
}
}

View File

@@ -15,11 +15,8 @@
*/
package org.springframework.data.elasticsearch.core;
import java.beans.IntrospectionException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.data.elasticsearch.entities.SampleDateMappingEntity;
@@ -28,20 +25,20 @@ import org.springframework.data.elasticsearch.entities.SampleDateMappingEntity;
* @author Jakub Vavrik
* @author Mohsin Husen
* @author Don Wellington
* @author Peter-Josef Meisch
*/
public class SimpleElasticsearchDateMappingTests {
public class SimpleElasticsearchDateMappingTests extends MappingContextBaseTests {
private static final String EXPECTED_MAPPING = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true," +
"\"type\":\"text\",\"index\":false,\"analyzer\":\"standard\"},\"customFormatDate\":{\"store\":false,\"type\":\"date\",\"format\":\"dd.MM.yyyy hh:mm\"}," +
"\"defaultFormatDate\":{\"store\":false,\"type\":\"date\"},\"basicFormatDate\":{\"store\":false,\"" +
"type\":\"date\",\"format\":\"basic_date\"}}}}";
private static final String EXPECTED_MAPPING = "{\"mapping\":{\"properties\":{\"message\":{\"store\":true,"
+ "\"type\":\"text\",\"index\":false,\"analyzer\":\"standard\"},\"customFormatDate\":{\"store\":false,\"type\":\"date\",\"format\":\"dd.MM.yyyy hh:mm\"},"
+ "\"defaultFormatDate\":{\"store\":false,\"type\":\"date\"},\"basicFormatDate\":{\"store\":false,\""
+ "type\":\"date\",\"format\":\"basic_date\"}}}}";
@Test
public void testCorrectDateMappings() throws NoSuchFieldException, IntrospectionException, IOException {
XContentBuilder xContentBuilder = MappingBuilder.buildMapping(SampleDateMappingEntity.class, "mapping", "id", null);
xContentBuilder.close();
ByteArrayOutputStream bos = (ByteArrayOutputStream) xContentBuilder.getOutputStream();
String result = bos.toString();
Assert.assertEquals(EXPECTED_MAPPING, result);
public void testCorrectDateMappings() throws IOException {
String mapping = getMappingBuilder().buildMapping(SampleDateMappingEntity.class);
Assert.assertEquals(EXPECTED_MAPPING, mapping);
}
}

View File

@@ -0,0 +1,106 @@
/*
* Copyright 2019 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/package org.springframework.data.elasticsearch.entities;
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.core.completion.Completion;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
/**
* @author Peter-Josef Meisch
*/
public class FieldNameEntity {
@Document(indexName = "fieldname-index", type = "fieldname-type")
public static class IdEntity {
@Id @Field("id-property")
private String id;
}
@Document(indexName = "fieldname-index", type = "fieldname-type")
public 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")
public 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")
public static class GeoPointEntity {
@Id @Field("id-property")
private String id;
@Field("geopoint-property")
private GeoPoint geoPoint;
}
@Document(indexName = "fieldname-index", type = "fieldname-type")
public 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")
public 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")
public 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;
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2019 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.entities;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Parent;
/**
* MinimalChildEntity
*
* @author Peter-josef Meisch
*/
@Document(indexName = "test-index-minimal", type = "mapping")
public class MinimalChildEntity {
@Id
private String id;
@Parent(type = "parentType")
private String parentId;
}