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
      }
    }
  }
}
相关推荐
鹧鸪云光伏21 分钟前
微电网容量规划软件:光储设备配置一站式解决方案
大数据·储能·光伏·储能设计方案
扫地的小何尚37 分钟前
NVIDIA Vera Rubin 平台如何解决 Agentic AI 的 Scale-up 难题
大数据·人工智能·机器学习
kekekka1 小时前
重塑品牌增长逻辑:专业媒体发稿服务如何让每一分预算产生长效复利?
大数据·搜索引擎·媒体
Gongxiangqishou3 小时前
县域即时配送订单规模同比增长35%,远超一线城市的22%
大数据·人工智能
落日屿星辰3 小时前
【无标题】
大数据
云登指纹浏览器4 小时前
指纹浏览器RPA自动化实战:跨境电商多账号运营效率提升指南
大数据·自动化·rpa
2601_957879334 小时前
短视频矩阵的数据驱动运营:从流量监测到内容迭代的完整技术链路
大数据·矩阵·音视频
珠海西格电力4 小时前
零碳园区的碳排放指标计算的实操步骤
大数据·运维·人工智能·物联网·能源
WL_Aurora4 小时前
大数据技术之SparkSQL
大数据·sparksql
简信CRM4 小时前
小微型企业如何利用CRM对公司内外部管理进行优化转型?
大数据·crm·简信crm