ElasticSeach 创建mapping


http://192.168.136.128:9200/motor_fans_user_info_index/
{
  "settings" : {
        "analysis" : {
            "analyzer" : {
                "ik" : {
                    "tokenizer" : "ik_max_word"
                }
            }
        }
    },
    "mappings" : {
        "motor_fans_user_info_index" : {
            "dynamic" : true,
            "properties" : {
                "username" : {
                    "type": "keyword",
                    "index":true
                },
                "username_ik" : {
                    "type": "text",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word",
                    "fielddata":true
                },
                "avatar":{
                    "type":"keyword",
                    "index":true
                },
                "mobile":{
                    "type":"keyword",
                    "index": true
                }
            }
        }
    }
}


short-topic
http://192.168.136.128:9200/motor_fans_short_topic/
{
    "settings" : {
        "analysis" : {
            "analyzer" : {
                "ik" : {
                    "tokenizer" : "ik_max_word"
                }
            }
        }
    },
    "mappings" : {
        "motor_fans_short_topic" : {
            "dynamic" : true,
            "properties" : {
                  "title_ik" :
                  {    "type": "text",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"
                  },
                "title" : {
                    "type":"keyword",
                    "index":true
                },
                "logo":{
                    "type":"keyword",
                    "index":true
                },
                "background":{
                    "type":"keyword",
                    "index": true
                },
                "location":{
                    "type":"keyword",
                    "index": true
                }
            }
        }
    }
}


Travels:

http://192.168.136.128:9200/motor_fans_travels/
{
    "settings" : {
        "analysis" : {
            "analyzer" : {
                "ik" : {
                    "tokenizer" : "ik_max_word"
                }
            }
        }
    },
    "mappings" : {
        "motor_fans_travels" : {
            "dynamic": "true",
            "properties": {
              "auther": {
               "type":"keyword",
                "index": true
              },
              "avatar": {
                "type":"keyword",
                "index": true
              },
              "cover": {
               "type":"keyword",
                "index": true
              },
              "title": {
               "type":"keyword",
                "index": true
              },
              "title_ik" :{    "type": "text",
                    "analyzer": "ik_max_word",
                    "search_analyzer": "ik_max_word"
                  }
            }
        }
    }
}





topic
http://192.168.136.128:9200/motor_fans_topic/
{
    "settings" : {
        "analysis" : {
            "analyzer" : {
                "ik" : {
                    "tokenizer" : "ik_max_word"
                }
            }
        }
    },
    "mappings" : {
        "motor_fans_topic" : {
            "dynamic": "true",
            "properties": {
              "name": {
               "type":"keyword",
                "index": true
              },
              "name_ik" :{
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_max_word"
              },
              "cover": {
               "type":"keyword",
                "index": true
              },
              "pic": {
               "type":"keyword",
                "index": true
              }
            }
        }
    }
}



http://192.168.136.128:9200/motor_fans_news_info/
{
"mappings" : {
    "motor_fans_news_info" : {
        "dynamic": "true",
        "properties": {
           "_id": {
           "type":"keyword",
            "index": true
          },
          "title": {
           "type":"keyword",
            "index": true
          },
          "cover": {
            "type":"keyword",
            "index": true
          },
          "auther": {
            "type":"keyword",
            "index": true
          },
          "infoType": {
            "type":"keyword",
            "index": true
          },
          
        }
    }
  }
}


-- 版块

http://192.168.136.128:9200/motor_fans_forum/

{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_forum" : {"dynamic": "true","properties": {"name": {"type":"keyword","index": true},"name_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word","fielddata":true},"forumimg": {"type":"keyword","index": true}}}}}




-- 资讯
http://192.168.136.128:9200/motor_fans_news_info/
{
"settings" : {
"analysis" : {
"analyzer" : {
"ik" : {
"tokenizer" : "ik_max_word"
}
}
}
},
"mappings" : {
"motor_fans_news_info" : {
"dynamic": "true",
"properties": {
"title": {
"type":"keyword",
"index": true
},
"title_ik" :{
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
},
"idType": {
"type":"keyword",
"index": true
},
"cover": {
"type":"keyword",
"index": true
},
"auther": {
"type":"keyword",
"index": true
}, "infoType": {"type":"keyword","index": true}}}}}



-- 动态

http://192.168.136.128:9200/motor_fans_moments_content/
{
"mappings" : {
    "motor_fans_moments_content" : {
            "dynamic": "true",
            "properties": {
              "content": {
               "type":"keyword",
                "index": true
              },
              "content_ik" :{
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_max_word"
              },
              "img": {
               "type":"keyword",
                "index": false
              },
              "location": {
               "type":"keyword",
                "index": false
              },
              "auther": {
               "type":"keyword",
                "index": false
              },
              "autherImg": {
               "type":"keyword",
                "index": false
              }
            }
        }
  }
}






curl -XGET 'http://192.168.20.18:9200/_cluster/health?pretty'

curl -XDELETE http://192.168.20.18:9200/motor_fans_travels

curl -XGET http://192.168.136.145:9200/motor_fans_travels/_mapping?pretty


----  测试环境

短话题:
curl -XPUT http://192.168.20.18:9200/motor_fans_short_topic/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_short_topic" : {"dynamic" : true,"properties" : {"title_ik" :{    "type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"title" : {"type":"keyword","index":true},"logo":{"type":"keyword","index":true},"background":{"type":"keyword","index": true},"location":{"type":"keyword","index": true}}}}}'

-- 游记  数据未处理
curl -XPUT http://192.168.20.18:9200/motor_fans_travels/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_travels" : {"dynamic": "true","properties": {"auther": {"type":"keyword","index": true},"avatar": {"type":"keyword","index": true},"cover": {"type":"keyword","index": true},"title": {"type":"keyword","index": true},"title_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}}}}}'

-- 话题  数据未处理
curl -XPUT http://192.168.20.18:9200/motor_fans_topic/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_topic" : {"dynamic": "true","properties": {"name": {"type":"keyword","index": true},"name_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"cover": {"type":"keyword","index": true},"pic": {"type":"keyword","index": true}}}}}'

-- 用户 数据未处理
curl -XPUT http://192.168.20.18:9200/motor_fans_user_info_index/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_user_info_index" : {"dynamic" : true,"properties" : {"username" : {"type": "keyword","index":true},"username_ik" : {"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word","fielddata":true},"avatar":{"type":"keyword","index":true},"mobile":{"type":"keyword","index": true}}}}}'

-- 版块  数据未处理
curl -XPUT http://192.168.20.18:9200/motor_fans_forum/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_forum" : {"dynamic": "true","properties": {"name": {"type":"keyword","index": true},"name_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word","fielddata":true},"forumimg": {"type":"keyword","index": true}}}}}'

-- 资讯  数据未处理
curl -XPUT http://192.168.20.18:9200/motor_fans_news_info/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_news_info" : {"dynamic": "true","properties": {"title": {"type":"keyword","index": true},"title_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"idType": {"type":"keyword","index": true},"cover": {"type":"keyword","index": true},"auther": {"type":"keyword","index": true}, "infoType": {"type":"keyword","index": true}}}}}'

-- 动态  数据未处理
curl -XPUT http://192.168.20.18:9200/motor_fans_moments_content/ -H "Content-Type:application/json" -d '{"mappings" : {"motor_fans_moments_content" : {"dynamic": "true","properties": {"content": {"type":"keyword","index": true},"content_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"img": {"type":"keyword","index": false},"location": {"type":"keyword","index": false},"auther": {"type":"keyword","index": false},"autherImg": {"type":"keyword","index": false}}}}}'






--- 正式环境

curl -XGET http://192.168.20.15:9200/motor_fans_moments_content/_mapping?pretty


curl -XDELETE http://192.168.20.15:9200/motor_fans_moments_content

短话题:
curl -XPUT http://192.168.20.15:9200/motor_fans_short_topic/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_short_topic" : {"dynamic" : true,"properties" : {"title_ik" :{    "type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"title" : {"type":"keyword","index":true},"logo":{"type":"keyword","index":true},"background":{"type":"keyword","index": true},"location":{"type":"keyword","index": true}}}}}'

-- 游记
curl -XPUT http://192.168.20.15:9200/motor_fans_travels/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_travels" : {"dynamic": "true","properties": {"auther": {"type":"keyword","index": true},"avatar": {"type":"keyword","index": true},"cover": {"type":"keyword","index": true},"title": {"type":"keyword","index": true},"title_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"}}}}}'

-- 话题
curl -XPUT http://192.168.20.15:9200/motor_fans_topic/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_topic" : {"dynamic": "true","properties": {"name": {"type":"keyword","index": true},"name_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"cover": {"type":"keyword","index": true},"pic": {"type":"keyword","index": true}}}}}'

-- 版块
curl -XPUT http://192.168.20.15:9200/motor_fans_forum/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_forum" : {"dynamic": "true","properties": {"name": {"type":"keyword","index": true},"name_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word","fielddata":true},"forumimg": {"type":"keyword","index": true}}}}}'

-- 资讯
curl -XPUT http://192.168.20.15:9200/motor_fans_news_info/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_news_info" : {"dynamic": "true","properties": {"title": {"type":"keyword","index": true},"title_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"idType": {"type":"keyword","index": true},"cover": {"type":"keyword","index": true},"auther": {"type":"keyword","index": true}, "infoType": {"type":"keyword","index": true}}}}}'

-- 动态
curl -XPUT http://192.168.20.15:9200/motor_fans_moments_content/ -H "Content-Type:application/json" -d '{"mappings" : {"motor_fans_moments_content" : {"dynamic": "true","properties": {"content": {"type":"keyword","index": true},"content_ik" :{"type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"img": {"type":"keyword","index": false},"location": {"type":"keyword","index": false},"auther": {"type":"keyword","index": false},"autherImg": {"type":"keyword","index": false}}}}}'


curl -XPUT http://192.168.20.16:9200/motor_fans_short_topic/ -H "Content-Type:application/json" -d '{"settings" : {"analysis" : {"analyzer" : {"ik" : {"tokenizer" : "ik_max_word"}}}},"mappings" : {"motor_fans_short_topic" : {"dynamic" : true,"properties" : {"title_ik" :{    "type": "text","analyzer": "ik_max_word","search_analyzer": "ik_max_word"},"title" : {"type":"keyword","index":true},"logo":{"type":"keyword","index":true},"background":{"type":"keyword","index": true},"location":{"type":"keyword","index": true}}}}}'




curl -XDELETE http://192.168.20.15:9200/motor_fans_travels


-- 查询 总数
curl -XGET http://192.168.20.15:9200/motor_fans_short_topic/motor_fans_short_topic/_count  -H "Content-Type:application/json" -d '{"query" : {"match_all" : { }}}'


kakfa 创建TOPIC
./bin/kafka-topics.sh --create --zookeeper ZooKeeper-node1:2181,ZooKeeper-node2:2181,ZooKeeper-node3:2181 --replication-factor 1 --partitions 1 --topic MOTOR_MOMENTS_CONTENT_TOPIC
./bin/kafka-topics.sh --create --zookeeper ZooKeeper-node1:2181,ZooKeeper-node2:2181,ZooKeeper-node3:2181 --replication-factor 1 --partitions 1 --topic FORUM_INFO_TOPIC


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值