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
      }
    }
  }
}
相关推荐
空杆推不起28 分钟前
穿透 Flink CDC 表层用法:数据库日志捕获机制、Flink Source 运行时、端到端一致性底层原理详解
大数据·数据库·flink
小邓的技术笔记1 小时前
DeepSeek 大模型落地应用与场景实战指南
大数据·人工智能
大大大大晴天️1 小时前
读懂 StarRocks 架构:FE、BE、CN 与 MPP 查询链路协同
大数据·starrocks·olap
2601_962966641 小时前
大学毕业可考取的市场营销专业实用证书指南
大数据·数据分析
北京晶数信息科技1 小时前
基于现有数据采集系统与智慧监管平台的成品油智慧监管+交易即开票一体化解决方案 (一)
大数据
Elasticsearch1 小时前
缩小 AI 差距:下一代知识访问如何为政府解锁任务成果
elasticsearch
WA内核拾荒者2 小时前
WhatsApp 对话内容的质量评估体系与自动化检测方案
大数据·人工智能·自动化
爱吃糖醋红烧肉2 小时前
2026年|靠谱外贸独立站建站服务商深度测评!
大数据·独立站搭建·外贸建站·谷歌建站·外贸独立站建站服务商·谷歌独立站建站服务商·出海企业必看
Elastic 中国社区官方博客3 小时前
Elasticsearch:搜索教程 - 语义搜索(三)
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
boppu12 小时前
布草特殊污渍去渍剂的种类及作用
大数据·人工智能