easy-es/docs/en/config.md
2022-03-17 11:01:44 +08:00

2.4 KiB

Basic configuration: If it is missing, it can cause the project to fail to start normally

easy-es:
  eanble: true # The default value is true, If the value of enable is false, it is considered that Easy-es is not enabled
  address: 127.0.0.0:9200 # Your elasticsearch address,must contains port, If it is a cluster, please separate with',' just like this: 127.0.0.0:9200,127.0.0.1:9200
  username: elastic # Es username, Not necessary, If it is not set in your elasticsearch, delete this line
  password: WG7WVmuNMtM4GwNYkyWH # Es password, Not necessary, If it is not set, delete this line

Extended configuration: It can be defaulted, in order to improve production performance, you can configure it further (only supported in version 0.9.4+)

easy-es:
  connectTimeout: 5000 # Connection timeout unit: ms
  socketTimeout: 5000 # Communication timeout unit: ms
  requestTimeout: 5000 # Request timeout unit: ms
  connectionRequestTimeout: 5000 # Connection request timeout
  maxConnTotal: 100 # Maximum number of connections
  maxConnPerRoute: 100 # Maximum number of connected routes

Global configuration: Can be defaulted, does not affect the project startup, if the default is the default value

easy-es:
  global-config:
    db-config:
      table-prefix: dev_ # Index prefix, can be used to distinguish the environment, the default is empty
      id-type: auto # id generation strategy defaults to auto
      field-strategy: not_empty # The field update strategy defaults to not_null, and the field is updated only when the field value is not empty

Tips:

  • id-type supports 2 types:
   auto: It is automatically generated by ES and is the default configuration, no additional configuration is          required for you. Recommended
   uuid: The system generates UUID, and then inserts ES (not recommended)
  • Field-strategy supports 3 types:
    • not_null: non-Null judgment, only when the field value is non-Null will be updated
    • not_empty: non-empty judgment, will be updated only when the field value is a non-empty string
    • ignore: Ignore the judgment, no matter what the field value is, it will be updated
  • After configuring the global policy, you can still customize the configuration for individual classes through annotations, and the priority of the global configuration is lower than the annotation configuration