Config
Basic configuration:
If missing, the project will not start properly, where the account password can be defaulted.
easy-es:
address : 127.0.0.1:9200 # es connection address + port The format must be ip:port, if it is a cluster, it can be separated by a comma.
username: elastic # If you don't have a password, you may not configure this line
password: WG7WVmuNMtM4GwNYkyWH #If you don't have an account password, you may not configure this line.
2
3
4
Extended configuration:
It can be defaulted, does not affect the project start, in order to improve the performance of the production environment, we recommend that you configure as needed
Special Note
If you have enabled index hosting-smooth mode (default on), and you need to migrate a large amount of data, you can adjust the socketTimeout, otherwise the migration may timeout exceptions The unit is milliseconds, the default is 1 minute, we have tested and found that it takes about 5 seconds to migrate 10,000 pieces of data, of course, the value needs to take into account your server hardware load and other factors, so we recommend You configure as needed, try to give a large not small, and the same thing, a large point is fine, too small you know!
easy-es:
keep-alive-millis: 30000 # heartbeat strategy time unit: ms
connect-timeout: 5000 # connection timeout time unit:ms
socket-timeout: 600000 # communication timeout in ms
request-timeout: 5000 # Request timeout in:ms
connection-request-timeout: 5000 # Connection request timeout in ms
max-conn-total: 100 # Maximum number of connections Unit:pcs
max-conn-per-route: 100 # max-conn-per-route unit:pcs
2
3
4
5
6
7
8
global-configuration:
Can be defaulted, does not affect the project start, if defaulted, it is the default value
easy-es:
enable: true # Whether to enable EE auto-configuration Default is enabled, can be defaulted
schema: http # Default is http, can be defaulted
banner: true # true by default Print banner If you don't want to print banner, you can configure it to false
global-config:
i-kun-mode: false # Whether to enable Heizi mode, it is off by default. After it is enabled, the log will be more interesting and enhance the fun of coding. It is for entertainment only and must not be used for any other purpose.
process-index-mode: manual # Index processing mode, smoothly: smoothly, not_smoothly: non-smoothly, manual: manual mode ,default mode is manual
print-dsl: true # enable the console to print the DSL statements generated by the framework , the default is on , the test is stable after the production environment is recommended to turn off , to improve a small amount of performance
distributed: false # whether the current project is a distributed project, the default is true, in non-manual managed indexing mode, if the distributed project will get a distributed lock, non-distributed projects only need to synchronized lock.
reindexTimeOutHours: 72 # Rebuild index timeout in hours, default 72H can be adjusted according to the amount of data stored in ES.
async-process-index-blocking: true # Whether asynchronous index processing blocks the main thread.
active-release-index-max-retry: 4320 # In distributed environment, smooth mode, the current client activates the latest index maximum number of retries, if the data volume is too large, rebuild index data migration time exceeds 4320/60=72H, adjust this parameter value upwards, this parameter value determines the maximum number of retries, after this number is exceeded, but still unsuccessful, then terminate the retry and record the exception log
active-release-index-fixed-delay: 60 # distributed environment, smooth mode, the current client activates the latest index maximum number of retries distributed environment, smooth mode, the current client activates the latest index retry interval If you expect the final consistency of the timeliness is higher, you can adjust this value downward, but will sacrifice some performance
db-config:
map-underscore-to-camel-case: false # Whether to enable underscore-to-camel default is false
index-prefix: daily_ # index prefix, can be used to distinguish the environment default is null Usage is the same as MP's tablePrefix role and usage
id-type: customize # id generation strategy customize is custom, id value generated by the user, such as taking the data id in MySQL, such as the default configuration, the id default strategy for es automatically generated
field-strategy: not_empty # field update strategy default is not_null
enable-track-total-hits: true # enabled by default, after the query all matching data, if not turned on, will lead to the inability to obtain the total number of data, other functions are not affected, if the number of queries exceeds 1W, you need to synchronize the @IndexName annotation in the maxResultWindow is also greater than 1w, and rebuild Index can only take effect after the subsequent query (not recommended, it is recommended that the paging query).
refresh-policy: immediate # data refresh policy, the default is not refresh, if the data timeliness requirements are relatively high, you can adjust to immediate, but the performance loss is high, you can also adjust to a compromise wait_until
batch-update-threshold: 10000 # The threshold of the batch update interface 默认值为1万,突破此值需要同步调整enable-track-total-hits=true,@IndexName.maxResultWindow > 1w, and rebuild the index.
smartAddKeywordSuffix: true # whether to add smart for the field.keyword suffix is enabled by default, after opening the current field index type and the current query type will automatically infer whether the query needs to be spliced.keyword suffix
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Dynamic data sources:
easy-es:
dynamic:
datasource:
ds1:
address: 10.20.64.228:9200 #Connection address of data source 1
#username: 'Remove this line if there is nothing'
#password: 'Remove this line if there is nothing'
ds2:
address: 49.234.28.111:9200 #Connection address of data source 2
#username: 'Remove this line if there is nothing'
#password: 'Remove this line if there is nothing'
#dsn…
2
3
4
5
6
7
8
9
10
11
12
Other configurations:
logging:
level:
tracer: trace # Enable trace level logging, you can turn on this configuration during development, then the console can print es all request information and DSL statements, in order to avoid duplication, after turning on this configuration, you can set EE's print-dsl to false.
2
3
Warm tips
id-type supports 3 types:
- auto: automatically generated by ES, it is the default configuration, you don't need to configure it.
- uuid: system generated UUID, then inserted into ES (not recommended)
- customize: user-defined, in this type, the user can put any data type id into es as the data id in es, such as the mysql self-added id as the id of es, you can turn on this mode, or specified by the @TableId(type) annotation.
field-strategy supports 3 types:
- not_null: non-null judgment, the field value will be updated only when it is non-null
- not_empty: non-null judgment, the field will be updated only when the value of the field is a non-null string
- ignore: ignore, the field will be updated regardless of the field value
- After configuring the global policy, you can still personalize the configuration by annotating individual classes, the priority of the global configuration is less than the annotation configuration
refresh-policy supports 3 types of policies
- none: the default policy, no data refresh
- immediate : immediate refresh, will lose more performance, for scenarios with high data real-time requirements
- wait_until: After the request is submitted, wait for the data to be refreshed (1s) and then end the request with moderate performance loss