博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
elasticsearch 添加settings and mapping
阅读量:2243 次
发布时间:2019-05-09

本文共 1948 字,大约阅读时间需要 6 分钟。

http://blog.csdn.net/dm_vincent/article/details/46996021
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html
https://elasticsearch.cn/question/2158
一。没有index数据时候方法:
1.后台创建空的index
2.配置analysis
执行以下:
特别注意:analysis中引用test,例如: userdict_ja.txt 如果太大,后边是没办法open的。
curl -XPOST 'localhost:9220/lbsindex/_close?pretty'
curl -XPUT 'localhost:9220/lbsindex/_settings?pretty' -H 'Content-Type: application/json' -d'
{"analysis":{
"filter":{
"stopword_dict":{
"type": "stop",
"stopwords_path": "stopword.txt"
},
"stopword_dict2":{
"type": "stop",
"stopwords": "_english_"
},
"katakana_stemmer":{
"type": "kuromoji_stemmer",
"minimum_length": 4
},
"whitespace_remove": {
"type": "pattern_replace",
"pattern": " ",
"replacement": ""
},
"filter_length": {
"type": "length",
"min": 1
}
},
"tokenizer":{
"kuromoji_user_dict": {
"type": "kuromoji_tokenizer",
"mode": "search",
"discard_punctuation": "false",
"user_dictionary": "userdict_ja.txt"
}
},
"analyzer":{
"myanalyzer":{
"type": "custom",
"tokenizer": "kuromoji_user_dict",
"filter": ["kuromoji_baseform","lowercase","stopword_dict","stopword_dict2","katakana_stemmer","cjk_width","whitespace_remove","filter_length"]
}
}
}
}'
curl -XPOST 'localhost:9220/lbsindex/_open?pretty'
#强制open:curl -i -XPOST 'http://localhost:9200/megacorp/_open/?pretty'
3.后台put_mapping
二。存在index数据的情况下:
https://www.elastic.co/blog/changing-mapping-with-zero-downtime
常用操作:
查看setings:
curl -XGET "localhost:9220/lbsindex/_settings?pretty"
查看mapping
curl -XGET "localhost:9220/lbsindex/item/_mapping?pretty"
添加mappings:
curl -XPUT localhost:9220/lbsindex/_mapping/item -H 'Content-Type: application/json' -d'
{
"mappings":{
"item" : {
"properties" : {
"geo": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}
}
}'
添加字段:
curl -XPUT 'http://localhost:9220/test-index/_mapping/logs_june' -d '
{
"logs_june" : {
"properties" : {
"message" : {"type" : "string", "store" : true }
}
}
}
'
你可能感兴趣的文章
Java程序初始化的顺序
查看>>
Dubbo和Spring结合配置文件内容解析为bean的过程
查看>>
fastJson注解@JSONField使用的一个实例
查看>>
fastjson的@JSONField注解的一点问题
查看>>
fastjson使用(三) -- 序列化
查看>>
浅谈使用单元素的枚举类型实现单例模式
查看>>
Java 利用枚举实现单例模式
查看>>
Java 动态代理作用是什么?
查看>>
Java动态代理机制详解(JDK 和CGLIB,Javassist,ASM) (清晰,浅显)
查看>>
三种线程安全的单例模式
查看>>
Spring AOP 和 动态代理技术
查看>>
从 volatile 说起,可见性和有序性是什么
查看>>
如何开始接手一个项目
查看>>
Netty 5用户指南
查看>>
Java实现简单的RPC框架
查看>>
一个用消息队列 的人,不知道为啥用 MQ,这就有点尴尬
查看>>
从零手写RPC
查看>>
高并发和多线程的关系
查看>>
Java并发与多线程
查看>>
对于多线程程序,单核cpu与多核cpu是怎么工作的
查看>>