zxl
5 天以前 8063ee7eee51bfe25a09428e6efc60f828b270c6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package cn.lili.elasticsearch.config;
 
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author paulG
 * @since 2020/10/13
 **/
@Data
@Builder
@Component("elasticsearchProperties")
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties(prefix = "lili.data.elasticsearch")
public class ElasticsearchProperties {
 
    /**
     * 请求协议
     */
    private String schema = "https";
 
    /**
     * 集群名称
     */
    private String clusterName = "elasticsearch";
 
    /**
     * 集群节点
     */
    @NotNull(message = "集群节点不允许为空")
    private List<String> clusterNodes = new ArrayList<>();
 
    /**
     * 索引前缀
     */
    private String indexPrefix;
 
    /**
     * 连接超时时间(毫秒)
     */
    private Integer connectTimeout = 1000;
 
    /**
     * socket 超时时间
     */
    private Integer socketTimeout = 30000;
 
    /**
     * 连接请求超时时间
     */
    private Integer connectionRequestTimeout = 500;
 
    /**
     * 每个路由的最大连接数量
     */
    private Integer maxConnectPerRoute = 10;
 
    /**
     * 最大连接总数量
     */
    private Integer maxConnectTotal = 30;
 
    /**
     * 索引配置信息
     */
    private Index index = new Index();
 
    /**
     * 认证账户
     */
    private Account account = new Account();
 
    /**
     * 索引配置信息
     */
    @Data
    public static class Index {
 
        /**
         * 分片数量
         */
        private Integer numberOfShards = 3;
 
        /**
         * 副本数量
         */
        private Integer numberOfReplicas = 2;
 
    }
 
    /**
     * 认证账户
     */
    @Data
    public static class Account {
 
        /**
         * 认证用户
         */
        private String username;
 
        /**
         * 认证密码
         */
        private String password;
 
    }
 
 
}