你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: menzhipeng 、AuroraXuesen
curl -XPOST http://localhost:9200/index/fulltext/_mapping -H 'Content-Type:application/json' -d' { "properties": { "content": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word" } } }'
rochy - rochy_he
赞同来自: menzhipeng
{ "order": 0, "template": "*", "settings": { "index": { "refresh_interval": "5s", "number_of_shards": "3", "max_result_window": 10000, "translog": { "flush_threshold_size": "500mb", "sync_interval": "30s", "durability": "async" }, "merge": { "scheduler": { "max_merge_count": "100", "max_thread_count": "1" } }, "number_of_replicas": "0", "unassigned": { "node_left": { "delayed_timeout": "1m" } } } }, "mappings": { "_doc": { "_all": { "enabled": false }, "dynamic_templates": [ { "id_field": { "mapping": { "type": "keyword", "store": "true" }, "match": "*_id" } }, { "no_field": { "mapping": { "type": "keyword", "store": "true" }, "match": "*_no" } }, { "geo_field": { "mapping": { "type": "geo_point", "store": "true" }, "match": "*_geo" } }, { "ip_field": { "mapping": { "type": "ip", "store": "true" }, "match": "*_ip" } }, { "len_field": { "mapping": { "type": "integer", "store": "true" }, "match": "*_len" } }, { "typ_field": { "mapping": { "type": "keyword", "store": "true" }, "match": "*_typ*" } }, { "sta_field": { "mapping": { "type": "keyword", "store": "true" }, "match": "*_sta" } }, { "lvl_field": { "mapping": { "type": "keyword", "store": "true" }, "match": "*_lvl" } }, { "flg_field": { "mapping": { "type": "keyword", "store": "true" }, "match": "*_flg" } }, { "dtm_field": { "mapping": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||yyyy-MM||yyyy||yyyy/MM/dd||yyyy/MM||epoch_millis", "store": "true" }, "match": "*_dtm" } }, { "ns_field": { "mapping": { "index": "false", "doc_values": "false", "norms": "false", "fielddata": "false", "store": "false" }, "match": "*_ns" } }, { "bin_field": { "mapping": { "type": "binary", "doc_values": "false", "norms": "false", "fielddata": "false", "store": "false" }, "match": "*_bin" } }, { "raw_field": { "mapping": { "type": "binary", "doc_values": "false", "norms": "false", "fielddata": "false", "store": "false" }, "match": "*_raw" } }, { "std_field": { "mapping": { "store": "true", "analyzer": "standard", "type": "text" }, "match": "*_std" } }, { "url_field": { "mapping": { "store": "true", "type": "keyword", "doc_values": "false", "norms": "false", "fielddata": "false" }, "match": "*_url" } }, { "file_field": { "mapping": { "type": "attachment", "fields": { "content": { "store": "false", "type": "text" }, "author": { "store": "true", "type": "text" }, "title": { "store": "true", "type": "text" }, "keywords": { "store": "true", "type": "text" }, "content_length": { "store": "true" }, "language": { "store": "true" }, "date": { "store": "true", "type": "date" }, "content_type": { "store": "true" } } }, "match": "*_file" } }, { "string_field": { "mapping": { "type": "text", "analyzer": "ik_max_word", "search_analyzer": "ik_max_word", "search_quote_analyzer": "ik_max_word", "term_vector": "with_positions_offsets", "fields": { "orginal": { "type": "keyword", "ignore_above": "36" } } }, "match_mapping_type": "string" } } ] } }, "aliases": {} }
menzhipeng
赞同来自:
要回复问题请先登录或注册
10 个回复
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: menzhipeng 、AuroraXuesen
参考下Medcl大的github:https://github.com/medcl/elasticsearch-analysis-ik
rochy - rochy_he
赞同来自: menzhipeng
你可以将你的配置贴出来看一下
rochy - rochy_he
赞同来自: menzhipeng
你可以使用索引模板来进行设置,也可以指定字段
rochy - rochy_he
赞同来自: menzhipeng
关于分词的大部分 Mapping 是无法修改的,即便能修改也是没有意义的;
因为修改前的数据并不会因为你的修改而生效,你必需重新覆盖写入才能生效,所以依旧推荐新建索引,然后使用 reindex 同步数据。
问题2:
设置 mapping 的时候需要指定 type,对于 ES6.X 而言,默认的 type 为 _doc
问题3:
搜索的时候可以不需要指定 type,对于 ES6.X 而言,一个索引只能有一个 type,指定与不指定都是一样的。
menzhipeng
赞同来自:
menzhipeng
赞同来自:
menzhipeng
赞同来自:
@Document(indexName = "articleindex",type = "articletype") 来设置type ,这个是否是必须的
3. 查询使用TransportClient 来实现,设置查询时的代码准备是下面这样:
builder = this.transportClient.prepareSearch(index) ;
this.transportClient.setTypes(type) ;
现在不确定 setType这个是否是必须要设置的,和问题二有关联
menzhipeng
赞同来自:
那么如何把旧索引数据移入新索引中,并且不影响新索引结构
rochy - rochy_he
赞同来自:
具体你可以参考:https://www.elastic.co/guide/e ... .html
menzhipeng
赞同来自: