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
      }
    }
  }
}
相关推荐
jiedaodezhuti4 小时前
Flink Checkpoint失败问题分析与解决方案
大数据·flink
海豚调度4 小时前
(二)一文读懂数仓设计的核心规范:从层次、类型到生命周期
大数据·数仓·技术规范
在未来等你4 小时前
Elasticsearch面试精讲 Day 15:索引别名与零停机更新
大数据·分布式·elasticsearch·搜索引擎·面试
IT研究室5 小时前
大数据毕业设计选题推荐-基于大数据的国内旅游景点游客数据分析系统-Spark-Hadoop-Bigdata
大数据·hadoop·spark·毕业设计·源码·数据可视化·bigdata
Lx3525 小时前
YARN资源调度优化:最大化集群利用率
大数据·hadoop
智能化咨询5 小时前
【56页PPT】数字化智能工厂总体设计SRMWCSWMSMES&EMS系统建设方案(附下载方式)
大数据·云计算
在未来等你6 小时前
Elasticsearch面试精讲 Day 12:数据建模与字段类型选择
大数据·分布式·elasticsearch·搜索引擎·面试
Leo.yuan6 小时前
不同数据仓库模型有什么不同?企业如何选择适合的数据仓库模型?
大数据·数据库·数据仓库·信息可视化·spark
Britz_Kevin6 小时前
从零开始的云计算生活——第六十天,志在千里,使用Jenkins部署K8S
云计算·jenkins·生活
chat2tomorrow6 小时前
数据采集平台的起源与演进:从ETL到数据复制
大数据·数据库·数据仓库·mysql·低代码·postgresql·etl