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

news/2025/2/12 16:35:15/

报错一

org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]
	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,问题解决

PUT /wzx-test
{"mappings": {"properties": {"car_num": {"type": "keyword","index": false},"name": {"type": "keyword","index": true},"age": {"type": "keyword","index": false}}}
}

http://www.ppmy.cn/news/1232282.html

相关文章

CentOS上搭建SVN并自动同步至web目录

一、搭建svn环境并创建仓库: 1、安装Subversion: yum install svn2、创建版本库: //先建目录 cd /www mkdir wwwsvn cd wwwsvn //创建版本库 svnadmin create xiangmumingcheng二、创建用户组及用户: 1、 进入版本库中的配…

如何将Docker的构建时间减少40%

与许多公司类似,我们为产品中使用的所有组件构建docker映像。随着时间的推移,其中一些映像变得越来越大,我们的CI构建花费的时间也越来越长。我的目标是CI构建不超过5分钟——差不多是喝杯咖啡休息的理想时间。如果构建花费的时间超过这个时间…

解决解析PDF编码报错(以pdfminer为例):UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte xxx

解决方法 博主使用的是pdfminer解析PDF文档,这个解决方法是通用的,只需要使PDFParser传入的文件为二进制文件即可,示例程序: from pdfminer.pdfparser import PDFParserpdf_parser PDFParser(open("pdf文件.pdf", &q…

【冒泡排序设计】

【冒泡排序设计】 思路代码结果 思路 冒泡排序这个算法,对于我这样的初学者来说,也不是很简单!!!(没有想象的那么简单)!  它的核心思想是:两两相邻的元素进行比较&#…

飞桨——总结PPOCRLabel中遇到的坑

操作系统:win10 python环境:python3.9 paddleocr项目版本:2.7 1.报错:ModuleNotFoundError: No module named Polygon(已解决) 已解决所以没有复现报错内容 尝试方法一:直接使用pip命令安装&…

IDEA版SSM入门到实战(Maven+MyBatis+Spring+SpringMVC) -Mybatis初识和框架搭建

第一章 初识Mybatis 1.1 框架概述 生活中“框架” 买房子笔记本电脑 程序中框架【代码半成品】 Mybatis框架:持久化层框架【dao层】SpringMVC框架:控制层框架【Servlet层】Spring框架:全能… 1.2 Mybatis简介 Mybatis是一个半自动化持久化…

城市易涝点怎么安装万宾科技内涝积水监测仪?

城市内涝是多个城市广泛存在的问题,经常给城市的居民和基础设施带来一些安全威胁。暴雨引发的道路积水和交通中断、财产损失,甚至公共安全威胁都是城市管理者需要提前预防的问题。为了解决这些问题,内涝积水监测仪的应用是一大重要的举措&…

使用Pytorch实现linear_regression

使用Pytorch实现线性回归 # import necessary packages import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt# Set necessary Hyper-parameters. input_size 1 output_size 1 num_epochs 60 learning_rate 0.001# Define a Toy datas…