mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-22 20:12:11 +00:00
Polishing
This commit is contained in:
parent
fbe54e485b
commit
161439ae22
@ -15,9 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.annotations;
|
package org.springframework.data.elasticsearch.annotations;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.core.annotation.AliasFor;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Inherited;
|
import java.lang.annotation.Inherited;
|
||||||
import java.lang.annotation.Repeatable;
|
import java.lang.annotation.Repeatable;
|
||||||
@ -25,6 +22,8 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import org.springframework.core.annotation.AliasFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies an alias for the index.
|
* Identifies an alias for the index.
|
||||||
*
|
*
|
||||||
@ -33,48 +32,48 @@ import java.lang.annotation.Target;
|
|||||||
*/
|
*/
|
||||||
@Inherited
|
@Inherited
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.TYPE})
|
@Target({ ElementType.TYPE })
|
||||||
@Repeatable(Aliases.class)
|
@Repeatable(Aliases.class)
|
||||||
public @interface Alias {
|
public @interface Alias {
|
||||||
/**
|
/**
|
||||||
* @return Index alias name. Alias for {@link #alias}.
|
* @return Index alias name. Alias for {@link #alias}.
|
||||||
*/
|
*/
|
||||||
@AliasFor("alias")
|
@AliasFor("alias")
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Index alias name. Alias for {@link #value}.
|
* @return Index alias name. Alias for {@link #value}.
|
||||||
*/
|
*/
|
||||||
@AliasFor("value")
|
@AliasFor("value")
|
||||||
String alias() default "";
|
String alias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Query used to limit documents the alias can access.
|
* @return Query used to limit documents the alias can access.
|
||||||
*/
|
*/
|
||||||
Filter filter() default @Filter;
|
Filter filter() default @Filter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Used to route indexing operations to a specific shard.
|
* @return Used to route indexing operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
String indexRouting() default "";
|
String indexRouting() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Used to route indexing and search operations to a specific shard.
|
* @return Used to route indexing and search operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
String routing() default "";
|
String routing() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Used to route search operations to a specific shard.
|
* @return Used to route search operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
String searchRouting() default "";
|
String searchRouting() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Is the alias hidden?
|
* @return Is the alias hidden?
|
||||||
*/
|
*/
|
||||||
boolean isHidden() default false;
|
boolean isHidden() default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Is it the 'write index' for the alias?
|
* @return Is it the 'write index' for the alias?
|
||||||
*/
|
*/
|
||||||
boolean isWriteIndex() default false;
|
boolean isWriteIndex() default false;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.annotations;
|
package org.springframework.data.elasticsearch.annotations;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Inherited;
|
import java.lang.annotation.Inherited;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
@ -31,7 +30,7 @@ import java.lang.annotation.Target;
|
|||||||
*/
|
*/
|
||||||
@Inherited
|
@Inherited
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.TYPE})
|
@Target({ ElementType.TYPE })
|
||||||
public @interface Aliases {
|
public @interface Aliases {
|
||||||
Alias[] value();
|
Alias[] value();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.annotations;
|
package org.springframework.data.elasticsearch.annotations;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.core.annotation.AliasFor;
|
import org.springframework.core.annotation.AliasFor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,15 +24,15 @@ import org.springframework.core.annotation.AliasFor;
|
|||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public @interface Filter {
|
public @interface Filter {
|
||||||
/**
|
/**
|
||||||
* @return Query used to limit documents. Alias for {@link #query}.
|
* @return Query used to limit documents. Alias for {@link #query}.
|
||||||
*/
|
*/
|
||||||
@AliasFor("query")
|
@AliasFor("query")
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Query used to limit documents. Alias for {@link #value}.
|
* @return Query used to limit documents. Alias for {@link #value}.
|
||||||
*/
|
*/
|
||||||
@AliasFor("value")
|
@AliasFor("value")
|
||||||
String query() default "";
|
String query() default "";
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,6 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||||
import org.springframework.data.elasticsearch.UncategorizedElasticsearchException;
|
import org.springframework.data.elasticsearch.UncategorizedElasticsearchException;
|
||||||
@ -63,8 +61,6 @@ import org.springframework.util.Assert;
|
|||||||
public class IndicesTemplate extends ChildTemplate<ElasticsearchTransport, ElasticsearchIndicesClient>
|
public class IndicesTemplate extends ChildTemplate<ElasticsearchTransport, ElasticsearchIndicesClient>
|
||||||
implements IndexOperations {
|
implements IndexOperations {
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(IndicesTemplate.class);
|
|
||||||
|
|
||||||
// we need a cluster client as well because ES has put some methods from the indices API into the cluster client
|
// we need a cluster client as well because ES has put some methods from the indices API into the cluster client
|
||||||
// (component templates)
|
// (component templates)
|
||||||
private final ClusterTemplate clusterTemplate;
|
private final ClusterTemplate clusterTemplate;
|
||||||
@ -88,7 +84,7 @@ public class IndicesTemplate extends ChildTemplate<ElasticsearchTransport, Elast
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IndicesTemplate(ElasticsearchIndicesClient client, ClusterTemplate clusterTemplate,
|
public IndicesTemplate(ElasticsearchIndicesClient client, ClusterTemplate clusterTemplate,
|
||||||
ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex) {
|
ElasticsearchConverter elasticsearchConverter, IndexCoordinates boundIndex) {
|
||||||
super(client, elasticsearchConverter);
|
super(client, elasticsearchConverter);
|
||||||
|
|
||||||
Assert.notNull(clusterTemplate, "cluster must not be null");
|
Assert.notNull(clusterTemplate, "cluster must not be null");
|
||||||
@ -242,8 +238,7 @@ public class IndicesTemplate extends ChildTemplate<ElasticsearchTransport, Elast
|
|||||||
GetMappingRequest getMappingRequest = requestConverter.indicesGetMappingRequest(indexCoordinates);
|
GetMappingRequest getMappingRequest = requestConverter.indicesGetMappingRequest(indexCoordinates);
|
||||||
GetMappingResponse getMappingResponse = execute(client -> client.getMapping(getMappingRequest));
|
GetMappingResponse getMappingResponse = execute(client -> client.getMapping(getMappingRequest));
|
||||||
|
|
||||||
Document mappingResponse = responseConverter.indicesGetMapping(getMappingResponse, indexCoordinates);
|
return responseConverter.indicesGetMapping(getMappingResponse, indexCoordinates);
|
||||||
return mappingResponse;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,14 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.client.elc;
|
package org.springframework.data.elasticsearch.client.elc;
|
||||||
|
|
||||||
import static org.springframework.util.StringUtils.hasText;
|
import static org.springframework.util.StringUtils.*;
|
||||||
|
|
||||||
import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase;
|
import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase;
|
||||||
import co.elastic.clients.elasticsearch.indices.*;
|
import co.elastic.clients.elasticsearch.indices.*;
|
||||||
import co.elastic.clients.transport.ElasticsearchTransport;
|
import co.elastic.clients.transport.ElasticsearchTransport;
|
||||||
import co.elastic.clients.transport.endpoints.BooleanResponse;
|
import co.elastic.clients.transport.endpoints.BooleanResponse;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.Alias;
|
|
||||||
import org.springframework.data.elasticsearch.core.mapping.CreateIndexSettings;
|
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
@ -49,6 +47,8 @@ import org.springframework.data.elasticsearch.core.index.GetIndexTemplateRequest
|
|||||||
import org.springframework.data.elasticsearch.core.index.GetTemplateRequest;
|
import org.springframework.data.elasticsearch.core.index.GetTemplateRequest;
|
||||||
import org.springframework.data.elasticsearch.core.index.PutIndexTemplateRequest;
|
import org.springframework.data.elasticsearch.core.index.PutIndexTemplateRequest;
|
||||||
import org.springframework.data.elasticsearch.core.index.PutTemplateRequest;
|
import org.springframework.data.elasticsearch.core.index.PutTemplateRequest;
|
||||||
|
import org.springframework.data.elasticsearch.core.mapping.Alias;
|
||||||
|
import org.springframework.data.elasticsearch.core.mapping.CreateIndexSettings;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity;
|
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
@ -113,7 +113,6 @@ import org.springframework.util.StringUtils;
|
|||||||
* @author Haibo Liu
|
* @author Haibo Liu
|
||||||
* @since 4.4
|
* @since 4.4
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("ClassCanBeRecord")
|
|
||||||
class RequestConverter extends AbstractQueryProcessor {
|
class RequestConverter extends AbstractQueryProcessor {
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(RequestConverter.class);
|
private static final Log LOGGER = LogFactory.getLog(RequestConverter.class);
|
||||||
@ -172,7 +171,8 @@ class RequestConverter extends AbstractQueryProcessor {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private co.elastic.clients.elasticsearch.indices.Alias.Builder buildAlias(AliasActionParameters parameters, co.elastic.clients.elasticsearch.indices.Alias.Builder aliasBuilder) {
|
private co.elastic.clients.elasticsearch.indices.Alias.Builder buildAlias(AliasActionParameters parameters,
|
||||||
|
co.elastic.clients.elasticsearch.indices.Alias.Builder aliasBuilder) {
|
||||||
|
|
||||||
if (parameters.getRouting() != null) {
|
if (parameters.getRouting() != null) {
|
||||||
aliasBuilder.routing(parameters.getRouting());
|
aliasBuilder.routing(parameters.getRouting());
|
||||||
@ -239,13 +239,13 @@ class RequestConverter extends AbstractQueryProcessor {
|
|||||||
public CreateIndexRequest indicesCreateRequest(CreateIndexSettings indexSettings) {
|
public CreateIndexRequest indicesCreateRequest(CreateIndexSettings indexSettings) {
|
||||||
Map<String, co.elastic.clients.elasticsearch.indices.Alias> aliases = new HashMap<>();
|
Map<String, co.elastic.clients.elasticsearch.indices.Alias> aliases = new HashMap<>();
|
||||||
for (Alias alias : indexSettings.getAliases()) {
|
for (Alias alias : indexSettings.getAliases()) {
|
||||||
co.elastic.clients.elasticsearch.indices.Alias esAlias = co.elastic.clients.elasticsearch.indices.Alias.of(ab -> ab.filter(getQuery(alias.getFilter(), null))
|
co.elastic.clients.elasticsearch.indices.Alias esAlias = co.elastic.clients.elasticsearch.indices.Alias
|
||||||
.routing(alias.getRouting())
|
.of(ab -> ab.filter(getQuery(alias.getFilter(), null))
|
||||||
.indexRouting(alias.getIndexRouting())
|
.routing(alias.getRouting())
|
||||||
.searchRouting(alias.getSearchRouting())
|
.indexRouting(alias.getIndexRouting())
|
||||||
.isHidden(alias.getHidden())
|
.searchRouting(alias.getSearchRouting())
|
||||||
.isWriteIndex(alias.getWriteIndex())
|
.isHidden(alias.getHidden())
|
||||||
);
|
.isWriteIndex(alias.getWriteIndex()));
|
||||||
aliases.put(alias.getAlias(), esAlias);
|
aliases.put(alias.getAlias(), esAlias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,7 +1026,7 @@ class RequestConverter extends AbstractQueryProcessor {
|
|||||||
order = sortField.order().jsonValue();
|
order = sortField.order().jsonValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return sortField.field() + ":" + order;
|
return sortField.field() + ':' + order;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
@ -1790,7 +1790,6 @@ class RequestConverter extends AbstractQueryProcessor {
|
|||||||
return getEsQuery(query, (q) -> elasticsearchConverter.updateQuery(q, clazz));
|
return getEsQuery(query, (q) -> elasticsearchConverter.updateQuery(q, clazz));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("StatementWithEmptyBody")
|
|
||||||
private void addPostFilter(Query query, SearchRequest.Builder builder) {
|
private void addPostFilter(Query query, SearchRequest.Builder builder) {
|
||||||
|
|
||||||
// we only need to handle NativeQuery here. filter from a CriteriaQuery are added into the query and not as post
|
// we only need to handle NativeQuery here. filter from a CriteriaQuery are added into the query and not as post
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.mapping;
|
package org.springframework.data.elasticsearch.core.mapping;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.core.query.Query;
|
import org.springframework.data.elasticsearch.core.query.Query;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immutable Value object encapsulating index alias(es).
|
* Immutable Value object encapsulating index alias(es).
|
||||||
*
|
*
|
||||||
@ -28,205 +28,191 @@ import java.util.Objects;
|
|||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public class Alias {
|
public class Alias {
|
||||||
/**
|
/**
|
||||||
* Alias name for the index.
|
* Alias name for the index.
|
||||||
*/
|
*/
|
||||||
private final String alias;
|
private final String alias;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query used to limit documents the alias can access.
|
* Query used to limit documents the alias can access.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final Query filter;
|
||||||
private final Query filter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to route indexing operations to a specific shard.
|
* Used to route indexing operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String indexRouting;
|
||||||
private final String indexRouting;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to route search operations to a specific shard.
|
* Used to route search operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String searchRouting;
|
||||||
private final String searchRouting;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to route indexing and search operations to a specific shard.
|
* Used to route indexing and search operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable private final String routing;
|
||||||
private final String routing;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The alias is hidden?
|
* The alias is hidden? By default, this is set to {@code false}.
|
||||||
* By default, this is set to {@code false}.
|
*/
|
||||||
*/
|
@Nullable private final Boolean isHidden;
|
||||||
@Nullable
|
|
||||||
private final Boolean isHidden;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index is the 'write index' for the alias?
|
* The index is the 'write index' for the alias? By default, this is set to {@code false}.
|
||||||
* By default, this is set to {@code false}.
|
*/
|
||||||
*/
|
@Nullable private final Boolean isWriteIndex;
|
||||||
@Nullable
|
|
||||||
private final Boolean isWriteIndex;
|
|
||||||
|
|
||||||
private Alias(Builder builder) {
|
private Alias(Builder builder) {
|
||||||
this.alias = builder.alias;
|
this.alias = builder.alias;
|
||||||
|
|
||||||
this.filter = builder.filter;
|
this.filter = builder.filter;
|
||||||
|
|
||||||
this.indexRouting = builder.indexRouting;
|
this.indexRouting = builder.indexRouting;
|
||||||
this.searchRouting = builder.searchRouting;
|
this.searchRouting = builder.searchRouting;
|
||||||
this.routing = builder.routing;
|
this.routing = builder.routing;
|
||||||
|
|
||||||
this.isHidden = builder.isHidden;
|
this.isHidden = builder.isHidden;
|
||||||
this.isWriteIndex = builder.isWriteIndex;
|
this.isWriteIndex = builder.isWriteIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Query getFilter() {
|
public Query getFilter() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getIndexRouting() {
|
public String getIndexRouting() {
|
||||||
return indexRouting;
|
return indexRouting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getSearchRouting() {
|
public String getSearchRouting() {
|
||||||
return searchRouting;
|
return searchRouting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getRouting() {
|
public String getRouting() {
|
||||||
return routing;
|
return routing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Boolean getHidden() {
|
public Boolean getHidden() {
|
||||||
return isHidden;
|
return isHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Boolean getWriteIndex() {
|
public Boolean getWriteIndex() {
|
||||||
return isWriteIndex;
|
return isWriteIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder builder(String alias) {
|
public static Builder builder(String alias) {
|
||||||
return new Builder(alias);
|
return new Builder(alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o)
|
||||||
if (!(o instanceof Alias that)) return false;
|
return true;
|
||||||
|
if (!(o instanceof Alias that))
|
||||||
|
return false;
|
||||||
|
|
||||||
return Objects.equals(alias, that.alias) && Objects.equals(filter, that.filter)
|
return Objects.equals(alias, that.alias) && Objects.equals(filter, that.filter)
|
||||||
&& Objects.equals(indexRouting, that.indexRouting)
|
&& Objects.equals(indexRouting, that.indexRouting)
|
||||||
&& Objects.equals(searchRouting, that.searchRouting)
|
&& Objects.equals(searchRouting, that.searchRouting)
|
||||||
&& Objects.equals(routing, that.routing)
|
&& Objects.equals(routing, that.routing)
|
||||||
&& Objects.equals(isHidden, that.isHidden)
|
&& Objects.equals(isHidden, that.isHidden)
|
||||||
&& Objects.equals(isWriteIndex, that.isWriteIndex);
|
&& Objects.equals(isWriteIndex, that.isWriteIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(alias, filter, indexRouting, searchRouting, routing, isHidden, isWriteIndex);
|
return Objects.hash(alias, filter, indexRouting, searchRouting, routing, isHidden, isWriteIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private final String alias;
|
private final String alias;
|
||||||
|
|
||||||
@Nullable
|
@Nullable private Query filter;
|
||||||
private Query filter;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable private String indexRouting;
|
||||||
private String indexRouting;
|
@Nullable private String searchRouting;
|
||||||
@Nullable
|
@Nullable private String routing;
|
||||||
private String searchRouting;
|
|
||||||
@Nullable
|
|
||||||
private String routing;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable private Boolean isHidden;
|
||||||
private Boolean isHidden;
|
@Nullable private Boolean isWriteIndex;
|
||||||
@Nullable
|
|
||||||
private Boolean isWriteIndex;
|
|
||||||
|
|
||||||
public Builder(String alias) {
|
public Builder(String alias) {
|
||||||
Assert.notNull(alias, "alias must not be null");
|
Assert.notNull(alias, "alias must not be null");
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query used to limit documents the alias can access.
|
* Query used to limit documents the alias can access.
|
||||||
*/
|
*/
|
||||||
public Builder withFilter(@Nullable Query filter) {
|
public Builder withFilter(@Nullable Query filter) {
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to route indexing operations to a specific shard.
|
* Used to route indexing operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
public Builder withIndexRouting(@Nullable String indexRouting) {
|
public Builder withIndexRouting(@Nullable String indexRouting) {
|
||||||
if (indexRouting != null && !indexRouting.trim().isEmpty()) {
|
if (indexRouting != null && !indexRouting.trim().isEmpty()) {
|
||||||
this.indexRouting = indexRouting;
|
this.indexRouting = indexRouting;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to route search operations to a specific shard.
|
* Used to route search operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
public Builder withSearchRouting(@Nullable String searchRouting) {
|
public Builder withSearchRouting(@Nullable String searchRouting) {
|
||||||
if (searchRouting != null && !searchRouting.trim().isEmpty()) {
|
if (searchRouting != null && !searchRouting.trim().isEmpty()) {
|
||||||
this.searchRouting = searchRouting;
|
this.searchRouting = searchRouting;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to route indexing and search operations to a specific shard.
|
* Used to route indexing and search operations to a specific shard.
|
||||||
*/
|
*/
|
||||||
public Builder withRouting(@Nullable String routing) {
|
public Builder withRouting(@Nullable String routing) {
|
||||||
if (routing != null && !routing.trim().isEmpty()) {
|
if (routing != null && !routing.trim().isEmpty()) {
|
||||||
this.routing = routing;
|
this.routing = routing;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The alias is hidden?
|
* The alias is hidden? By default, this is set to {@code false}.
|
||||||
* By default, this is set to {@code false}.
|
*/
|
||||||
*/
|
public Builder withHidden(@Nullable Boolean hidden) {
|
||||||
public Builder withHidden(@Nullable Boolean hidden) {
|
isHidden = hidden;
|
||||||
isHidden = hidden;
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index is the 'write index' for the alias?
|
* The index is the 'write index' for the alias? By default, this is set to {@code false}.
|
||||||
* By default, this is set to {@code false}.
|
*/
|
||||||
*/
|
public Builder withWriteIndex(@Nullable Boolean writeIndex) {
|
||||||
public Builder withWriteIndex(@Nullable Boolean writeIndex) {
|
isWriteIndex = writeIndex;
|
||||||
isWriteIndex = writeIndex;
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias build() {
|
public Alias build() {
|
||||||
return new Alias(this);
|
return new Alias(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.mapping;
|
package org.springframework.data.elasticsearch.core.mapping;
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.core.document.Document;
|
|
||||||
import org.springframework.lang.Nullable;
|
|
||||||
import org.springframework.util.Assert;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.data.elasticsearch.core.document.Document;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encapsulating index mapping fields, settings, and index alias(es).
|
* Encapsulating index mapping fields, settings, and index alias(es).
|
||||||
*
|
*
|
||||||
@ -30,88 +30,85 @@ import java.util.Set;
|
|||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
public class CreateIndexSettings {
|
public class CreateIndexSettings {
|
||||||
private final IndexCoordinates indexCoordinates;
|
private final IndexCoordinates indexCoordinates;
|
||||||
private final Set<Alias> aliases;
|
private final Set<Alias> aliases;
|
||||||
|
|
||||||
@Nullable
|
@Nullable private final Map<String, Object> settings;
|
||||||
private final Map<String, Object> settings;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable private final Document mapping;
|
||||||
private final Document mapping;
|
|
||||||
|
|
||||||
private CreateIndexSettings(Builder builder) {
|
private CreateIndexSettings(Builder builder) {
|
||||||
this.indexCoordinates = builder.indexCoordinates;
|
this.indexCoordinates = builder.indexCoordinates;
|
||||||
this.aliases = builder.aliases;
|
this.aliases = builder.aliases;
|
||||||
|
|
||||||
this.settings = builder.settings;
|
this.settings = builder.settings;
|
||||||
this.mapping = builder.mapping;
|
this.mapping = builder.mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder builder(IndexCoordinates indexCoordinates) {
|
public static Builder builder(IndexCoordinates indexCoordinates) {
|
||||||
return new Builder(indexCoordinates);
|
return new Builder(indexCoordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexCoordinates getIndexCoordinates() {
|
public IndexCoordinates getIndexCoordinates() {
|
||||||
return indexCoordinates;
|
return indexCoordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Alias[] getAliases() {
|
public Alias[] getAliases() {
|
||||||
return aliases.toArray(Alias[]::new);
|
return aliases.toArray(Alias[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getSettings() {
|
@Nullable
|
||||||
return settings;
|
public Map<String, Object> getSettings() {
|
||||||
}
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Document getMapping() {
|
public Document getMapping() {
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private IndexCoordinates indexCoordinates;
|
private final IndexCoordinates indexCoordinates;
|
||||||
private final Set<Alias> aliases = new HashSet<>();
|
private final Set<Alias> aliases = new HashSet<>();
|
||||||
|
|
||||||
@Nullable
|
@Nullable private Map<String, Object> settings;
|
||||||
private Map<String, Object> settings;
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable private Document mapping;
|
||||||
private Document mapping;
|
|
||||||
|
|
||||||
public Builder(IndexCoordinates indexCoordinates) {
|
public Builder(IndexCoordinates indexCoordinates) {
|
||||||
Assert.notNull(indexCoordinates, "indexCoordinates must not be null");
|
Assert.notNull(indexCoordinates, "indexCoordinates must not be null");
|
||||||
this.indexCoordinates = indexCoordinates;
|
this.indexCoordinates = indexCoordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder withAlias(Alias alias) {
|
public Builder withAlias(Alias alias) {
|
||||||
Assert.notNull(alias, "alias must not be null");
|
Assert.notNull(alias, "alias must not be null");
|
||||||
this.aliases.add(alias);
|
this.aliases.add(alias);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder withAliases(Set<Alias> aliases) {
|
public Builder withAliases(Set<Alias> aliases) {
|
||||||
Assert.notNull(aliases, "aliases must not be null");
|
Assert.notNull(aliases, "aliases must not be null");
|
||||||
this.aliases.addAll(aliases);
|
this.aliases.addAll(aliases);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder withSettings(Map<String, Object> settings) {
|
public Builder withSettings(Map<String, Object> settings) {
|
||||||
Assert.notNull(settings, "settings must not be null");
|
Assert.notNull(settings, "settings must not be null");
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder withMapping(@Nullable Document mapping) {
|
public Builder withMapping(@Nullable Document mapping) {
|
||||||
this.mapping = mapping;
|
this.mapping = mapping;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CreateIndexSettings build() {
|
public CreateIndexSettings build() {
|
||||||
return new CreateIndexSettings(this);
|
return new CreateIndexSettings(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.mapping;
|
package org.springframework.data.elasticsearch.core.mapping;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.data.elasticsearch.annotations.Document;
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
import org.springframework.data.elasticsearch.annotations.Dynamic;
|
import org.springframework.data.elasticsearch.annotations.Dynamic;
|
||||||
import org.springframework.data.elasticsearch.annotations.Field;
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
@ -25,8 +27,6 @@ import org.springframework.data.mapping.PersistentEntity;
|
|||||||
import org.springframework.data.mapping.model.FieldNamingStrategy;
|
import org.springframework.data.mapping.model.FieldNamingStrategy;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ElasticsearchPersistentEntity
|
* ElasticsearchPersistentEntity
|
||||||
*
|
*
|
||||||
@ -76,7 +76,7 @@ public interface ElasticsearchPersistentEntity<T> extends PersistentEntity<T, El
|
|||||||
boolean isCreateIndexAndMapping();
|
boolean isCreateIndexAndMapping();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the {@link ElasticsearchPersistentProperty} with the given fieldName (may be set by the {@link Field}
|
* returns the {@link ElasticsearchPersistentProperty} with the given fieldName (can be set by the {@link Field})
|
||||||
* annotation.
|
* annotation.
|
||||||
*
|
*
|
||||||
* @param fieldName to field name for the search, must not be {@literal null}
|
* @param fieldName to field name for the search, must not be {@literal null}
|
||||||
@ -199,7 +199,7 @@ public interface ElasticsearchPersistentEntity<T> extends PersistentEntity<T, El
|
|||||||
boolean storeVersionInSource();
|
boolean storeVersionInSource();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the mapping should be written to the index on repositry bootstrap even if the index already exists.
|
* @return if the mapping should be written to the index on repository bootstrap even if the index already exists.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
boolean isAlwaysWriteMapping();
|
boolean isAlwaysWriteMapping();
|
||||||
|
@ -258,12 +258,12 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
|||||||
if (property.isIndexedIndexNameProperty()) {
|
if (property.isIndexedIndexNameProperty()) {
|
||||||
|
|
||||||
if (!property.getActualType().isAssignableFrom(String.class)) {
|
if (!property.getActualType().isAssignableFrom(String.class)) {
|
||||||
throw new MappingException(String.format("@IndexedIndexName annotation must be put on String property"));
|
throw new MappingException("@IndexedIndexName annotation must be put on String property");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexedIndexNameProperty != null) {
|
if (indexedIndexNameProperty != null) {
|
||||||
throw new MappingException(
|
throw new MappingException(
|
||||||
String.format("@IndexedIndexName annotation can only be put on one property in an entity"));
|
"@IndexedIndexName annotation can only be put on one property in an entity");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.indexedIndexNameProperty = property;
|
this.indexedIndexNameProperty = property;
|
||||||
@ -653,8 +653,7 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
|||||||
.withRouting(alias.routing())
|
.withRouting(alias.routing())
|
||||||
.withHidden(alias.isHidden())
|
.withHidden(alias.isHidden())
|
||||||
.withWriteIndex(alias.isWriteIndex())
|
.withWriteIndex(alias.isWriteIndex())
|
||||||
.build()
|
.build());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.elasticsearch.core.index;
|
package org.springframework.data.elasticsearch.core.index;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
|
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -71,7 +71,7 @@ public abstract class IndexOperationsIntegrationTests {
|
|||||||
@Test
|
@Test
|
||||||
@Order(java.lang.Integer.MAX_VALUE)
|
@Order(java.lang.Integer.MAX_VALUE)
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + "*")).delete();
|
operations.indexOps(IndexCoordinates.of(indexNameProvider.getPrefix() + '*')).delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #1646, #1718
|
@Test // #1646, #1718
|
||||||
@ -198,8 +198,8 @@ public abstract class IndexOperationsIntegrationTests {
|
|||||||
.extracting(StringQuery::getSource)
|
.extracting(StringQuery::getSource)
|
||||||
.asString()
|
.asString()
|
||||||
.contains(Queries.wrapperQuery("""
|
.contains(Queries.wrapperQuery("""
|
||||||
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
||||||
""").query());
|
""").query());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||||
@ -219,12 +219,13 @@ public abstract class IndexOperationsIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Document(indexName = "#{@indexNameProvider.indexName()}", aliases = {
|
@Document(indexName = "#{@indexNameProvider.indexName()}", aliases = {
|
||||||
@Alias(value = "first_alias", filter =@Filter("""
|
@Alias(value = "first_alias", filter = @Filter("""
|
||||||
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
||||||
"""))
|
"""))
|
||||||
})
|
})
|
||||||
private static class EntityWithAliases {
|
private static class EntityWithAliases {
|
||||||
@Nullable private @Id String id;
|
@Nullable private @Id String id;
|
||||||
|
@Nullable
|
||||||
@Field(type = Text) private String type;
|
@Field(type = Text) private String type;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -236,6 +237,7 @@ public abstract class IndexOperationsIntegrationTests {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,9 @@ package org.springframework.data.elasticsearch.core.index;
|
|||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
import static org.assertj.core.api.Assertions.*;
|
||||||
import static org.skyscreamer.jsonassert.JSONAssert.*;
|
import static org.skyscreamer.jsonassert.JSONAssert.*;
|
||||||
import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
|
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
|
||||||
import static org.springframework.data.elasticsearch.core.IndexOperationsAdapter.*;
|
import static org.springframework.data.elasticsearch.core.IndexOperationsAdapter.*;
|
||||||
|
|
||||||
import org.assertj.core.api.InstanceOfAssertFactories;
|
|
||||||
import org.springframework.data.elasticsearch.annotations.Alias;
|
|
||||||
import org.springframework.data.elasticsearch.annotations.Filter;
|
|
||||||
import org.springframework.data.elasticsearch.client.elc.Queries;
|
|
||||||
import org.springframework.data.elasticsearch.core.query.StringQuery;
|
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.test.StepVerifier;
|
import reactor.test.StepVerifier;
|
||||||
|
|
||||||
@ -32,22 +27,27 @@ import java.time.LocalDate;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Order;
|
import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Alias;
|
||||||
import org.springframework.data.elasticsearch.annotations.DateFormat;
|
import org.springframework.data.elasticsearch.annotations.DateFormat;
|
||||||
import org.springframework.data.elasticsearch.annotations.Document;
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
import org.springframework.data.elasticsearch.annotations.Field;
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
import org.springframework.data.elasticsearch.annotations.FieldType;
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Filter;
|
||||||
import org.springframework.data.elasticsearch.annotations.Mapping;
|
import org.springframework.data.elasticsearch.annotations.Mapping;
|
||||||
import org.springframework.data.elasticsearch.annotations.Setting;
|
import org.springframework.data.elasticsearch.annotations.Setting;
|
||||||
|
import org.springframework.data.elasticsearch.client.elc.Queries;
|
||||||
import org.springframework.data.elasticsearch.core.IndexOperations;
|
import org.springframework.data.elasticsearch.core.IndexOperations;
|
||||||
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
|
import org.springframework.data.elasticsearch.core.ReactiveElasticsearchOperations;
|
||||||
import org.springframework.data.elasticsearch.core.ReactiveIndexOperations;
|
import org.springframework.data.elasticsearch.core.ReactiveIndexOperations;
|
||||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||||
|
import org.springframework.data.elasticsearch.core.query.StringQuery;
|
||||||
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
|
import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest;
|
||||||
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
|
import org.springframework.data.elasticsearch.utils.IndexNameProvider;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
@ -367,7 +367,8 @@ public abstract class ReactiveIndexOperationsIntegrationTests {
|
|||||||
indexOperations.getAliasesForIndex(indexName)
|
indexOperations.getAliasesForIndex(indexName)
|
||||||
.as(StepVerifier::create)
|
.as(StepVerifier::create)
|
||||||
.assertNext(aliases -> {
|
.assertNext(aliases -> {
|
||||||
AliasData result = aliases.values().stream().findFirst().orElse(new HashSet<>()).stream().findFirst().orElse(null);
|
AliasData result = aliases.values().stream().findFirst().orElse(new HashSet<>()).stream().findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
assertThat(result).isNotNull();
|
assertThat(result).isNotNull();
|
||||||
assertThat(result.getAlias()).isEqualTo("first_alias");
|
assertThat(result.getAlias()).isEqualTo("first_alias");
|
||||||
@ -375,8 +376,8 @@ public abstract class ReactiveIndexOperationsIntegrationTests {
|
|||||||
.extracting(StringQuery::getSource)
|
.extracting(StringQuery::getSource)
|
||||||
.asString()
|
.asString()
|
||||||
.contains(Queries.wrapperQuery("""
|
.contains(Queries.wrapperQuery("""
|
||||||
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
||||||
""").query());
|
""").query());
|
||||||
}).verifyComplete();
|
}).verifyComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,7 +438,7 @@ public abstract class ReactiveIndexOperationsIntegrationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Document(indexName = "#{@indexNameProvider.indexName()}", aliases = {
|
@Document(indexName = "#{@indexNameProvider.indexName()}", aliases = {
|
||||||
@Alias(value = "first_alias", filter =@Filter("""
|
@Alias(value = "first_alias", filter = @Filter("""
|
||||||
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
{"bool" : {"must" : {"term" : {"type" : "abc"}}}}
|
||||||
"""))
|
"""))
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user