升级到spring-boot-starter:2.2.5.RELEASE之后,spring-cloud-dependencies:Hoxton.SR3,spring-cloud-stream-dependencies:Horsham.SR3和spring-data-elasticsearch:3.2.5。发布。布尔字段不存储在索引/文档中。它在较早版本的Spring Boot 2.1.11中工作。
我尝试使用ElasticSearch REST API手动创建文档。直接使用REST API尝试时,布尔字段存储在索引中。
是否对布尔字段声明映射进行了任何更改?
我正在使用ElasticsearchTemplate.index(IndexQuery)API创建索引文档,其中IndexQuery是使用具有一些布尔字段的文档对象构建的。
以下是CatalogIndex.java文件中的布尔值字段。
@Document(indexName = "catalogentity")
public class CatalogIndex {
private boolean isType;
private boolean isAbstract;
private boolean isFinal;
private String stateId;
private String stageId;
//some other fields
public boolean isType() {
return isType;
}
public void setType(final boolean type) {
isType = type;
}
public boolean isAbstract() {
return isAbstract;
}
public void setAbstract(final boolean anAbstract) {
isAbstract = anAbstract;
}
public boolean isFinal() {
return isFinal;
}
public void setFinal(final boolean aFinal) {
isFinal = aFinal;
}
//some other setter and getters
映射如下
{
"properties": {
"type": {
"type": "boolean"
},
"abstract": {
"type": "boolean"
},
"final": {
"type": "boolean"
},
"stateId": {
"type": "text"
},
"stageId": {
"type": "keyword"
}
}
}
谢谢,桑索什
@Document(indexName = "catalogentity")
public class CatalogIndex {
private boolean isType;
private boolean abstract1;
private boolean final1;
private String stateId;
private String stageId;
//some other fields
public boolean isType() {
return isType;
}
public void setType(final boolean type) {
isType = type;
}
public boolean isAbstract1() {
return abstract1;
}
public void setAbstract1(final boolean abstract1) {
this.abstract1 = abstract1;
}
public boolean isFinal1() {
return final1;
}
public void setFinal1(final boolean final1) {
this.final1 = final1;
}
//some other setter and getters
映射如下
{
"properties": {
"type": {
"type": "boolean"
},
"abstract1": {
"type": "boolean"
},
"final1": {
"type": "boolean"
},
"stateId": {
"type": "text"
},
"stageId": {
"type": "keyword"
}
}
}