• ES Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed


    查看日志切分:
    sed -n '/2022-03-21 01:50:11.785/,/2022-03-21 02:25:01.130/p' test-2022-03-21-1.log > 220321.txt


    2022-03-21 01:55:01.153 [http-nio-1374-exec-9]org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]

    日志内容:

    {
    	"error": {
    		"root_cause": [{
    			"type": "query_shard_exception",
    			"reason": "failed to create query: {……
    			"term\" : {\n                \"test.status\" : {\n                  \"value\" : \"]\",\n                  \"boost\" : 1.0\n                }……",
    			"index_uuid": "tAihAg8iQhqt4xAaCh8JHA",
    			"index": "order_idx"
    		}],
    		"type": "search_phase_execution_exception",
    		"reason": "all shards failed",
    		"phase": "query",
    		"grouped": true,
    		"failed_shards": [{
    			"shard": 0,
    			"index": "order_idx",
    			"node": "DMRXw_qLQS-QsqFpckgVEw",
    			"reason": {
    				"type": "query_shard_exception",
    				"reason": "failed to create query: {……
    				"term\" : {\n                \"test.status\" : {\n                  \"value\" : \"]\",\n                  \"boost\" : 1.0\n                }……",
    				"index_uuid": "tAihAg8iQhqt4xAaCh8JHA",
    				"index": "order_idx",
    				"caused_by": {
    					"type": "number_format_exception",
    					"reason": "For input string: \"]\""
    				}
    			}
    		}]
    	},
    	"status": 400
    }
    //boolQueryBuilder.should(QueryBuilders.termQuery("test.status", new int[]{1,2}));
    正确: 数组过滤方式
    boolQueryBuilder.should(QueryBuilders.termsQuery("test.status", new int[]{1,2}));
    //源代码:参数是Object
        //A Query that matches documents containing a term.
        public static TermQueryBuilder termQuery(String name, Object value) {
            return new TermQueryBuilder(name, value);
        }
        
        //A filter for a field based on several terms matching on any of them.
        public static TermsQueryBuilder termsQuery(String name, Object... values) {
            return new TermsQueryBuilder(name, values);
        }
        
        //TermQueryBuilder和TermsQueryBuilder是QueryBuilder子类
        public BoolQueryBuilder should(QueryBuilder queryBuilder) {
            if (queryBuilder == null) {
                throw new IllegalArgumentException("inner bool query clause cannot be null");
            }
            shouldClauses.add(queryBuilder);
            return this;
        }
  • 相关阅读:
    第五篇:JMeter 定时器
    第四篇:JMeter 性能测试基本过程及示例
    第三篇:JMeter 组件手册
    第一篇 HTTP 协议报文结构及示例
    第二篇 JMeter 目录及关键配置分析
    第一篇:什么是 JMeter和为什么选择Jmeter做性能测试
    教你如何识别百度蜘蛛IP含义
    DEDECMS安装之后需要做的安全处理和须知
    织梦联动类别-地区调用不显示第三级城市的原因
    CSS的特效
  • 原文地址:https://www.cnblogs.com/oktokeep/p/16038566.html
Copyright © 2020-2023  润新知