第一步 :创建es 的索引

        settings : 索引的设置

        mappings : 映射

PUT xxx_index
{
  "settings": {
    "index":{
      "search": {
        "slowlog": {
          "level": "info",
          "threshold": {
            "fetch": {
              "warn": "200ms",
              "trace": "50ms",
              "debug": "80ms",
              "info": "100ms"
            },
            "query": {
              "warn": "500ms",
              "trace": "50ms",
              "debug": "100ms",
              "info": "200ms"
            }
          }
        }
      },
      "indexing": {
        "slowlog": {
          "level": "info",
          "threshold": {
            "index": {
              "warn": "200ms",
              "trace": "20ms",
              "debug": "50ms",
              "info": "100ms"
            }
          },
          "source": "1000"
        }
      },
      "number_of_shards": "5",
      "analysis": {
      "normalizer": {
        "my_normalizer": {
          "type": "custom",
          "char_filter": [],
          "filter": ["lowercase", "asciifolding"]
        }
      }
    }
    }
  },
  "mappings": {
    "trademark_type": {
      "properties": {
        "applicationAddress": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "applicationDate": {
          "type": "date"
        },
        "applicationSerialNumber": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "applicationStatus": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "brandName": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "brandType": {
          "type": "long"
        },
        "id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "mark": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "origin": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "id_id": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "doc": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
         "termBrandName": {
          "type": "keyword",
          "normalizer": "my_normalizer",
          "ignore_above": 256
        }
      }
    }
  }
}

(如果数据无法添加到索引中)重新创建活动索引

PUT xxx_index
{
  "aliases": {
    "app-write": {
      "is_write_index": true
    }
  }
}

查看索引的  mappings 

GET /trademark_index/_mapping

添加数据

POST /xxx_index/_search
{
	"brandName":"[\"NORTH STAR TRAVEL CENTERS\"]",
	"applicationAddress":"[\"North Star Management Group, LLC\"]",
	"applicationDate":"2022-02-23",
	"applicationStatus":"Pending",
	"applicationSerialNumber":"",
	"origin":"US",
	"brandType":[37,42],
	"mark":""
}

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐