Elasticsearch7 升级后的一些知识点归纳

拼音,ik分词

https://www.cnblogs.com/dashuaiguo/p/10014978.html

https://blog.csdn.net/shi_yi_fei/article/details/85266449

elasticsearch  通过设置模板自定义一些初始化的数据,比如副本,分词

https://www.elastic.co/guide/en/elasticsearch/reference/7.0/indices-templates.html

设置默认的分片和副本

curl -XPUT 'http://10.xx.xx.xx:9200/_template/template_http_request_record' -H 'Content-Type: application/json' -d

{

  "index_patterns": [

    "*"

  ],

  "settings": {

    "number_of_shards": 5,

    "number_of_replicas": 1

  }

}

 

允许设置type名称(不建议)

curl -XPUT http://10.xx.xx.xx:9200/course5/?include_type_name=true

#####################

设置索引副本,分片,指定分词器

PUT book_v5

{

"settings":{

"number_of_shards": "6",

"number_of_replicas": "1",

"analysis":{

"analyzer":{

"ik":{

"tokenizer":"ik_max_word"

}

}

}

},

"mappings":{

"properties":{

"author":{

"type":"text"

},

"wordCount":{

"type":"integer"

},

"publishDate":{

"type":"date",

"format":"yyyy-MM-dd HH:mm:ss || yyyy-MM-dd"

},

"briefIntroduction":{

"type":"text"

},

"bookName":{

"type":"text"

}

}

}

}

 

在建了索引的 时候指定

 

 

PUT test

{

    "settings" : {

        "number_of_shards" : 1

    },

    "mappings" : {

        "type1" : {

            "properties" : {

                "field1" : { "type" : "text" }

            }

        }

    }

}

查询分词效果:

GET /_analyze

{

"text":"中华人民共和国国徽",

"analyzer":"ik_smart"

}


版权声明:本文为oJinTian1234567原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。