码迷,mamicode.com
首页 > 其他好文 > 详细

ElasticSearch 常用设置

时间:2018-04-26 19:07:15      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:oca   asi   att   draw   analyzer   mail   dex   defs   ntp   

 

分词查找

http://localhost:9200/_analyze?analyzer=ik_max_word&&text=中华人民共和国

 

查看Mapping的方法

http://127.0.0.1:9200/jlindex/_mapping?pretty

 

通过Head的复合查询设置Mapping(文本禁用分词)

找到Head的复合查询部分

技术分享图片

 

在查询第一行填入地址和要创建索引的名称,例如索引的名称是jlindex

技术分享图片

 

 

另外,查询下左边栏位置空,右边栏位因为是新增索引和设置Mapping,所以设置为POST

把要提交的Mapping粘贴进去,点击提交按钮即可完成新建索引的Mapping

技术分享图片

 

 

{
    "mappings": {
        "saledatatype": {
            "properties": {
                "FYear": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FQuarter": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FMonth": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FDate": {
                    "type": "date",
                    "format": "strict_date_optional_time||epoch_millis"
                },
                "City": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "CustomerName": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FAmount": {
                    "type": "double"
                },
                "FItemClassID": {
                    "type": "long"
                },
                "FItemID": {
                    "type": "long"
                },
                "FItemID1": {
                    "type": "long"
                },
                "FItemID2": {
                    "type": "long"
                },
                "FItemID3": {
                    "type": "long"
                },
                "FItemID4": {
                    "type": "long"
                },
                "FItemID5": {
                    "type": "long"
                },
                "FItemID6": {
                    "type": "long"
                },
                "FName": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FName1": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FName2": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FName3": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FName4": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FName5": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FName6": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "FNumber": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FNumber1": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FNumber2": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FNumber3": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FNumber4": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FNumber5": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FNumber6": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "FQTy": {
                    "type": "double"
                },
                "ItemName": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "ItemNumber": {
                    "type": "string",
                    "index": "not_analyzed"

                },
                "Province": {
                    "type": "string",
                    "index": "not_analyzed"

                }
            }
        }
    }
}

 

 

 设置IK分词

{
    "mappings": {
        "saledatatype": {
            "properties": {
                "City": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"
                },
                "CustomerName": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"
                },
                "FAmount": {
                    "type": "double"
                },
                "FDate": {
                    "type": "date",
                    "format": "strict_date_optional_time||epoch_millis"
                },
                "FItemClassID": {
                    "type": "long"
                },
                "FItemID": {
                    "type": "long"
                },
                "FItemID1": {
                    "type": "long"
                },
                "FItemID2": {
                    "type": "long"
                },
                "FItemID3": {
                    "type": "long"
                },
                "FItemID4": {
                    "type": "long"
                },
                "FItemID5": {
                    "type": "long"
                },
                "FItemID6": {
                    "type": "long"
                },
                "FName": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FName1": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FName2": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FName3": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FName4": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FName5": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FName6": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber1": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber2": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber3": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber4": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber5": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FNumber6": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "FQTy": {
                    "type": "double"
                },
                "ItemName": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "ItemNumber": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                },
                "Province": {
                    "type": "string",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"

                }
            }
        }
    }
}

 

ElasticSearch 常用设置

标签:oca   asi   att   draw   analyzer   mail   dex   defs   ntp   

原文地址:https://www.cnblogs.com/Bruce_H21/p/8954428.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!