作者 王勇

ES索引名修改,以及分词器选择修改

... ... @@ -23,7 +23,7 @@ import java.util.Date;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "message_note")
@Document(indexName = "message")
public class MessageNote implements Serializable {
private static final long serialVersionUID = -2119333801860569470L;
... ... @@ -42,7 +42,7 @@ public class MessageNote implements Serializable {
/**
* 所属用户登陆名称
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Keyword)
private String username;
/**
... ... @@ -54,7 +54,7 @@ public class MessageNote implements Serializable {
/**
* 所属服务器名称
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Keyword)
private String serverName;
/**
... ... @@ -66,7 +66,7 @@ public class MessageNote implements Serializable {
/**
* 所属虚拟主机名称
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Keyword)
private String virtualHostName;
/**
... ... @@ -78,7 +78,7 @@ public class MessageNote implements Serializable {
/**
* 所属交换机名称
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Keyword)
private String exchangeName;
/**
... ... @@ -90,7 +90,7 @@ public class MessageNote implements Serializable {
/**
* 所属队列名称
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Keyword)
private String queueName;
/**
... ... @@ -102,7 +102,7 @@ public class MessageNote implements Serializable {
/**
* 所属路由键的名称
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Keyword)
private String routingKeyName;
/**
... ... @@ -141,7 +141,7 @@ public class MessageNote implements Serializable {
/**
* 发送消息内容,别名
*/
@Field(type = FieldType.Text, analyzer = "ik_max_word")
@Field(type = FieldType.Text, analyzer = "ik_smart", searchAnalyzer = "ik_max_word")
private String alias_sendContent;
/**
... ...
... ... @@ -51,7 +51,7 @@ public class ElasticsearchService {
public ResultJson selectMessageNoteList(MessageNote messageNote, Integer pageNum, Integer pageSize) throws IOException
{
// 条件搜索
SearchRequest searchRequest = new SearchRequest("message_note");
SearchRequest searchRequest = new SearchRequest("message");
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
// 高亮设置
... ...