ES增加字段

This commit is contained in:
daihh
2023-02-08 10:26:24 +08:00
parent b7249f8811
commit 3815b17ed0
2 changed files with 9 additions and 0 deletions

View File

@@ -141,6 +141,7 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
//builder.field("audience").startObject().field("type", "text").field("analyzer","comma").endObject();
builder.field("audiences").startObject().field("type", "keyword").endObject();
builder.field("device").startObject().field("type", "integer").endObject();
builder.field("openEnroll").startObject().field("type", "integer").endObject();
builder.endObject();
builder.endObject();
@@ -168,6 +169,9 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
return null;
}
}
if(cf.getOpenEnroll()==null) {
cf.setOpenEnroll(0);
}
//检查是否已存在
IndexRequest indexRequest = new IndexRequest(indexName);
ObjectMapper mapper=new ObjectMapper();
@@ -231,6 +235,10 @@ public class CourseElasticsearchImpl implements ICourseFullTextSearch{
String fullId=fullTextId;
if(item.getOpenEnroll()==null) {
item.setOpenEnroll(0);
}
boolean exists=false;
if(StringUtils.isNotBlank(fullTextId)) {
GetRequest getRequest=new GetRequest(indexName,fullTextId);

View File

@@ -81,6 +81,7 @@ public class CourseStudyElasticsearchImpl implements ICourseStudySearch{
builder.field("startTime").startObject().field("type", "integer").endObject();
builder.field("status").startObject().field("type", "integer").endObject();
builder.field("progress").startObject().field("type", "integer").endObject();
builder.field("applyStatus").startObject().field("type", "integer").endObject();
builder.endObject();
builder.endObject();