然后就是分词字典配置下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases
选择与自己ElasticSearch版本号一致的zip包进行下载
下载完后复制到ElasticSearch安装路径的plugins目录下,然后解压缩,因为解压后文件夹名字有点长,可以修改一下,一般大家都习惯性地修改为ik
进入ik分词器路径下的config目录,修改IKAnalyzer.cfg.xml
IK Analyzer 扩展配置 a.dic;b.dic
2、查询超过10000条数据的分页配置完后重启ES
先看看报错
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "public_resource_master",
"node" : "C38y1RXeTQKvLw8U0cgqWw",
"reason" : {
"type" : "illegal_argument_exception",
"reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
}
}
],
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting."
}
}
},
"status" : 400
}
仔细阅读错误消息(This limit can be set by changing the [index.max_result_window] index level setting.)后,发现可以通过更改 [index.max_result_window] 索引级别设置来设置此限制。
PUT your_index_name/_settings
{
"index": {
"max_result_window": 1000000000 # 默认为10000,修改后立即生效,无须重启ES
}
}
3、跨域设置
# 修改elasticsearch.yml文件,添加一下配置 http.cors.enabled: true http.cors.allow-origin: "*" # http.cors.allow-headers: Content-Type,Accept,Authorization, x-requested-with4、开启远程访问
# 修改elasticsearch.yml配置文件,修改设置 network.host: 0.0.0.0 # 转发 transport.host: localhost # TCP端口转发 transport.tcp.port: 9300 # http端口 http.port: 9200
注:开启远程访问后,防火墙也要开放9200端口入站规则,如果是阿里云服务器还要添加安全组规则



