mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-05-31 09:12:11 +00:00
DATAES-874 - Deprecate parent-id related methods and fields.
Original PR: #488
This commit is contained in:
parent
7d8bc81fdd
commit
ea98ef4533
@ -18,6 +18,9 @@ They do the same, but `putMapping` is consistent with the naming in the Elastics
|
||||
.Alias handling
|
||||
In the `IndexOperations` interface the methods `addAlias(AliasQuery)`, `removeAlias(AliasQuery)` and `queryForAlias()` have been deprecated. The new methods `alias(AliasAction)`, `getAliases(String...)` and `getAliasesForIndex(String...)` offer more functionality and a cleaner API.
|
||||
|
||||
.Parent-ID
|
||||
Usage of a parent-id has been removed from Elasticsearch since version 6. We now deprecate the corresponding fields and methods.
|
||||
|
||||
[[elasticsearch-migration-guide-4.0-4.1.removal]]
|
||||
== Removals
|
||||
|
||||
|
@ -23,8 +23,9 @@ import org.springframework.data.annotation.Persistent;
|
||||
* Parent
|
||||
*
|
||||
* @author Philipp Jardas
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
@Persistent
|
||||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -235,14 +235,18 @@ class EntityOperations {
|
||||
* Returns whether the entity has a parent.
|
||||
*
|
||||
* @return {@literal true} if the entity has a parent that has an {@literal id}.
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasParent();
|
||||
|
||||
/**
|
||||
* Returns the parent Id. Can be {@literal null}.
|
||||
*
|
||||
* @return can be {@literal null}.
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
Object getParentId();
|
||||
|
||||
@ -589,6 +593,7 @@ class EntityOperations {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.elasticsearch.core.EntityOperations.AdaptibleEntity#getParentId()
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
public Object getParentId() {
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class MappingBuilder {
|
||||
|
||||
private static final String FIELD_INDEX = "index";
|
||||
private static final String FIELD_PROPERTIES = "properties";
|
||||
private static final String FIELD_PARENT = "_parent";
|
||||
@Deprecated private static final String FIELD_PARENT = "_parent";
|
||||
private static final String FIELD_CONTEXT_NAME = "name";
|
||||
private static final String FIELD_CONTEXT_TYPE = "type";
|
||||
private static final String FIELD_CONTEXT_PATH = "path";
|
||||
|
@ -53,9 +53,17 @@ public interface ElasticsearchPersistentEntity<T> extends PersistentEntity<T, El
|
||||
@Override
|
||||
ElasticsearchPersistentProperty getVersionProperty();
|
||||
|
||||
/**
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
String getParentType();
|
||||
|
||||
/**
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
ElasticsearchPersistentProperty getParentIdProperty();
|
||||
|
||||
|
@ -62,7 +62,9 @@ public interface ElasticsearchPersistentProperty extends PersistentProperty<Elas
|
||||
*
|
||||
* @return
|
||||
* @since 3.1
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isParentProperty();
|
||||
|
||||
/**
|
||||
|
@ -63,8 +63,8 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
||||
private short replicas;
|
||||
private @Nullable String refreshInterval;
|
||||
private @Nullable String indexStoreType;
|
||||
private @Nullable String parentType;
|
||||
private @Nullable ElasticsearchPersistentProperty parentIdProperty;
|
||||
@Deprecated private @Nullable String parentType;
|
||||
@Deprecated private @Nullable ElasticsearchPersistentProperty parentIdProperty;
|
||||
private @Nullable ElasticsearchPersistentProperty scoreProperty;
|
||||
private @Nullable ElasticsearchPersistentProperty seqNoPrimaryTermProperty;
|
||||
private @Nullable String settingPath;
|
||||
@ -135,12 +135,14 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@Deprecated
|
||||
public String getParentType() {
|
||||
return parentType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@Deprecated
|
||||
public ElasticsearchPersistentProperty getParentIdProperty() {
|
||||
return parentIdProperty;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class IndexQuery {
|
||||
@Nullable private Object object;
|
||||
@Nullable private Long version;
|
||||
@Nullable private String source;
|
||||
@Nullable private String parentId;
|
||||
@Deprecated @Nullable private String parentId;
|
||||
@Nullable private Long seqNo;
|
||||
@Nullable private Long primaryTerm;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class IndexQueryBuilder {
|
||||
@Nullable private Object object;
|
||||
@Nullable private Long version;
|
||||
@Nullable private String source;
|
||||
@Nullable private String parentId;
|
||||
@Deprecated @Nullable private String parentId;
|
||||
@Nullable private Long seqNo;
|
||||
@Nullable private Long primaryTerm;
|
||||
|
||||
@ -55,6 +55,7 @@ public class IndexQueryBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IndexQueryBuilder withParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
return this;
|
||||
|
@ -42,6 +42,10 @@ public interface ElasticsearchEntityInformation<T, ID> extends EntityInformation
|
||||
@Nullable
|
||||
VersionType getVersionType();
|
||||
|
||||
/**
|
||||
* @deprecated since 4.1, not supported anymore by Elasticsearch
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
String getParentId(T entity);
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ public class MappingElasticsearchEntityInformation<T, ID> extends PersistentEnti
|
||||
return persistentEntity.getVersionType();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public String getParentId(T entity) {
|
||||
|
||||
|
@ -169,16 +169,6 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
||||
assertThat(entry.getPrice()).isCloseTo(BigDecimal.valueOf(price), Percentage.withPercentage(0.01));
|
||||
}
|
||||
|
||||
@Test // DATAES-568
|
||||
public void shouldCreateMappingForSpecifiedParentType() throws JSONException {
|
||||
|
||||
String expected = "{\"_parent\":{\"type\":\"parentType\"},\"properties\":{}}";
|
||||
|
||||
String mapping = getMappingBuilder().buildPropertyMapping(MinimalChildEntity.class);
|
||||
|
||||
assertEquals(expected, mapping, false);
|
||||
}
|
||||
|
||||
@Test // DATAES-76
|
||||
public void shouldBuildMappingWithSuperclass() throws JSONException {
|
||||
|
||||
@ -668,19 +658,6 @@ public class MappingBuilderTests extends MappingContextBaseTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MinimalChildEntity
|
||||
*
|
||||
* @author Peter-Josef Meisch
|
||||
*/
|
||||
@Document(indexName = "test-index-minimal")
|
||||
static class MinimalChildEntity {
|
||||
|
||||
@Nullable @Id private String id;
|
||||
|
||||
@Nullable @Parent(type = "parentType") private String parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Rizwan Idrees
|
||||
* @author Mohsin Husen
|
||||
|
Loading…
x
Reference in New Issue
Block a user