es各种报错问题及解决方案20231121

报错一

javascript 复制代码
org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]
javascript 复制代码
	Suppressed: org.elasticsearch.client.ResponseException: method [POST], host [http://localhost:9200], URI [/wzx-test/_search?pre_filter_shard_size=128&typed_keys=true&max_concurrent_shard_requests=5&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled=true&search_type=query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true], status line [HTTP/1.1 400 Bad Request]
Warnings: [Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security., [ignore_throttled] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers in place of frozen indices.]
{"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: Cannot search on field [name] since it is not indexed.","index_uuid":"ERtTBqoxQziiFS50j6658Q","index":"wzx-test"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"wzx-test","node":"cCxDpWCeSqK2ll3x31-W_g","reason":{"type":"query_shard_exception","reason":"failed to create query: Cannot search on field [name] since it is not indexed.","index_uuid":"ERtTBqoxQziiFS50j6658Q","index":"wzx-test","caused_by":{"type":"illegal_argument_exception","reason":"Cannot search on field [name] since it is not indexed."}}}]},"status":400}
		at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:283)
		at org.elasticsearch.client.RestClient.performRequest(RestClient.java:261)
		at org.elasticsearch.client.RestClient.performRequest(RestClient.java:235)
		at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1514)
		... 109 common frames omitted

报错原因:我在创建索引和字段的时候,name字段不是索引字段,当用精准查询的时候,就报错如上图所示

解决方案:将name字段设置成true,问题解决

javascript 复制代码
PUT /wzx-test
{
  "mappings": {
    "properties": {
      "car_num": {
        "type": "keyword",
        "index": false
      },
      "name": {
        "type": "keyword",
        "index": true
      },
      "age": {
        "type": "keyword",
        "index": false
      }
    }
  }
}
相关推荐
青云交2 小时前
Java 大视界 -- Java 大数据机器学习模型在金融信用评级模型优化与信用风险动态管理中的应用(371)
java·大数据·机器学习·信用评级·动态风控·跨境金融·小贷风控
笙囧同学5 小时前
基于大数据技术的疾病预警系统:从数据预处理到机器学习的完整实践(后附下载链接)
大数据·网络·机器学习
思绪漂移9 小时前
阿里云【免费试用】Elasticsearch 智能运维 AI 助手
运维·elasticsearch·阿里云
java叶新东老师13 小时前
git 提交时排除一个或多个文件
大数据·git·elasticsearch
阿里云大数据AI技术14 小时前
Hologres V3.1版本发布,Serverless型实例从零开始构建OLAP系统
大数据·人工智能·机器学习
秋难降16 小时前
一篇文章带你了解Pandassssssssssssssss
大数据·python·pandas
数据皮皮侠16 小时前
中国汽车能源消耗量(2010-2024年)
大数据·数据库·人工智能·物联网·金融·汽车·能源
TDengine (老段)16 小时前
TDengine 转化函数 TO_TIMESTAMP 用户手册
java·大数据·数据库·物联网·时序数据库·tdengine·涛思数据
LiRuiJie17 小时前
基于Hadoop3.3.4+Flink1.17.0+FlinkCDC3.0.0+Iceberg1.5.0整合,实现数仓实时同步mysql数据
大数据·hadoop·flink·iceberg·flinkcdc
时序数据说17 小时前
时序数据库IoTDB的优势场景分析
大数据·数据库·物联网·时序数据库·iotdb