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
      }
    }
  }
}
相关推荐
注塑机数据采集联网3 小时前
中科晟达注塑机智能数据采集联网(ZK-D1/D3)接入 MES 与 IOT 平台,并用 AI 大模型分析数据
大数据·人工智能·物联网·数据采集·注塑机网关·注塑机mes系统
RobinXYuan3 小时前
【SQLMesh 调研】02 搭一套能重复跑的湖仓测试环境
大数据
csdn2015_4 小时前
git 只显示最近一个月活跃的分支
git·elasticsearch·策略模式
智购科技自动售货机厂家5 小时前
自动售货机外设接口与总线设计实战:串口、CAN 与 GPIO 的分工~YH
java·大数据·服务器·数据库·人工智能·单片机·嵌入式硬件
moonsims5 小时前
AiBrainBox机器人多传感器标定与测试联合实验室-企业技术牵引·学校教学组织·师生共同实施·联合成果转化-企业、老师、学生组角色分工
大数据·网络·人工智能·无人机·量子计算
TDengine (老段)6 小时前
TDengine TSDB 磁盘占用清理与缩减指南
大数据·数据库·物联网·时序数据库·tdengine·涛思数据·iotdb
岳涛_daemon6 小时前
检索|同一个字段,TSDB 默认开 skippers、普通索引默认关,ES 不建 BKD 也能过滤
elasticsearch
向科→向总工→空间动态计系统6 小时前
剃刀明盒:几何与时序双验证
大数据·开发语言·人工智能·python
Pin_Qing7 小时前
优惠期结束与计费周期更迭:Gemini 4 Carbon/Argon 价格调整后的架构应对
大数据·开发语言·人工智能·程序人生·架构