Config
Basic configuration:
If it is missing, the project cannot be started normally, and the account password can be defaulted.
easy-es:
enable: true # Whether to enable EE automatic configuration
address : 127.0.0.1:9200 # es connection address + port format must be ip:port, if it is a cluster, it can be separated by commas
schema: http # default is http
username: elastic #If there is no account password, you can not configure this line
password: WG7WVmuNMtM4GwNYkyWH #If there is no account password, you can not configure this line
2
3
4
5
6
Extended configuration:
It can be defaulted and does not affect the project startup. In order to improve the performance of the production environment, it is recommended that you configure it as needed.
special attention
If you have enabled index hosting-smooth mode (enabled by default) and you need to migrate a large amount of data, it is recommended to increase socketTimeout, otherwise the migration will timeout abnormally The unit is milliseconds. After testing, we found that it takes about 5 seconds to migrate 10,000 pieces of data. Of course, this value needs to comprehensively consider factors such as your server hardware load. Therefore, it is recommended to You configure it according to your needs, try your best to give big and not small, just like that thing, bigger is fine, too small, you know!
easy-es:
keep-alive-millis: 18000 # Heartbeat strategy time unit: ms
connectTimeout: 5000 # Connection timeout unit: ms
socketTimeout: 5000 # Communication timeout unit: ms
requestTimeout: 5000 # Request timeout unit: ms
connectionRequestTimeout: 5000 # Connection request timeout unit: ms
maxConnTotal: 100 # Maximum number of connections Unit: Piece
maxConnPerRoute: 100 # Maximum number of connected routes Unit: Piece
2
3
4
5
6
7
8
Global configuration:
It can be defaulted, it does not affect the project startup, if it is default, it is the default value
easy-es:
banner: false # The default is true to print the banner If you don't want to print the banner, you can configure it to false
global-config:
process_index_mode: smoothly #Index processing mode, smoothly: smooth mode, this mode is enabled by default, not_smoothly: non-smooth mode, manual: manual mode
print-dsl: true # Turn on the console to print the DSL statements generated by this framework, the default is turned on, it is recommended to turn off the production environment after the test is stable to improve a small amount of performance
distributed: false # Whether the current project is a distributed project, the default is true, in the non-manual managed index mode, if it is a distributed project, it will acquire distributed locks, and non-distributed projects only need synchronized locks.
asyncProcessIndexBlocking : true # Whether the asynchronous processing index blocks the main thread? Default blocking In the case of a large amount of data, it is recommended to adjust to asynchronous non-blocking, which can speed up the project startup speed
activeReleaseIndexMaxRetry: 60 # In a distributed environment, in smooth mode, the current client activates the latest index maximum number of retries. If the amount of data is too large, the re-index data migration time exceeds 60*(180/60)=180 minutes, this value can be increased Parameter value, this parameter value determines the maximum number of retries. If the number of retries is exceeded, the retry will be terminated and an exception log will be recorded.
activeReleaseIndexFixedDelay: 180 # In a distributed environment, smooth mode, the current client activates the latest index maximum number of retries. If the amount of data is too large, the re-index data migration time exceeds 60*(180/60)=180 minutes, you can increase this value Parameter value This parameter value determines how often to retry unit: seconds
db-config:
map-underscore-to-camel-case: false # Whether to enable underscore to camel case Default is false
table-prefix: daily_ # Index prefix, which can be used to distinguish environments Default is empty Usage is the same as MP
id-type: customize # id generation strategy customize is custom, and the id value is generated by the user, such as taking the data id in MySQL. If this configuration is default, the default id strategy is automatically generated by es
field-strategy: not_empty # field update strategy defaults to not_null
enable-track-total-hits: true # It is enabled by default. If the specified size exceeds 1w, it will be automatically enabled. After opening, all matching data will be queried. If it is not enabled, the total number of data will not be obtained, and other functions will not work Affected.
refresh-policy: immediate # Data refresh policy, the default is no refresh
enable-must2-filter: false # Whether to globally enable the conversion of the must query type to the filter query type The default is false and no conversion
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Other configuration:
logging:
level:
tracer: trace # Turn on the trace level log. This configuration can be turned on during development, and the console can print all es request information and DSL statements. In order to avoid repetition, after this configuration is turned on, EE's print-dsl can be set to false .
2
3
Tips
id-type supports 3 types:
- auto: automatically generated by ES, it is the default configuration, no additional configuration is required for you
- uuid: The system generates UUID, and then inserts into ES (not recommended)
- customize: User-defined, in this type, the user can store the id of any data type into es as the data id in es, for example, use the id that is self-incremented by mysql as the id of es, you can enable this mode, or pass @ TableId(type) annotation specifies.
field-strategy supports 3 types:
- not_null: Non-Null judgment, when the field value is not Null, will be updated
- not_empty: non-empty judgment, the field value will only be updated when the field value is not an empty string
- ignore: ignore the judgment, no matter what the field value is, it will be updated
- After configuring the global strategy, you can still configure individual classes through annotations. The priority of global configuration is lower than that of annotation configuration
refresh-policy supports 3 policies
- none: default policy, no data refresh
- immediate : Immediate refresh, which will consume more performance, suitable for scenarios with high data real-time requirements
- wait_until: After requesting to submit data, wait for the data to be refreshed (1s) before ending the request. The performance loss is moderate