elasticsearch直方图方面异常

js4nwp54  于 2021-07-09  发布在  Java
关注(0)|答案(0)|浏览(212)

当我对我的 events 索引:

{
"query": { 
    "query_string": {
        "query": "*"
    } 
},
"facets": {
    "histo1": {
        "histogram": { 
            "key_field": "authorid",
            "value_field": "article",
            "interval": 10
        }
    }
}
}

我得到一个错误:

"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[_2jzw4DMR9mSnl5vLIK_4A][events][0]: SearchParseException[[events][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\r\n\t\"query\": { \r\n\t\t\"query_string\": {\r\n\t\t\t\"query\": \"*\"\r\n\t\t} \r\n\t},\r\n\t\"facets\": {\r\n\t\t\"histo1\": {\r\n\t\t\t\"histogram\": { \r\n\t\t\t\t\"key_field\": \"authorid\",\r\n\t\t\t\t\"value_field\": \"article\",\r\n\t\t\t\t\"interval\": 10\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}]]]; nested: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]; }{[_2jzw4DMR9mSnl5vLIK_4A][events][2]: SearchParseException[[events][2]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\r\n\t\"query\": { \r\n\t\t\"query_string\": {\r\n\t\t\t\"query\": \"*\"\r\n\t\t} \r\n\t},\r\n\t\"facets\": {\r\n\t\t\"histo1\": {\r\n\t\t\t\"histogram\": { \r\n\t\t\t\t\"key_field\": \"authorid\",\r\n\t\t\t\t\"value_field\": \"article\",\r\n\t\t\t\t\"interval\": 10\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}]]]; nested: { goes on and on this way... }

两个 key_field 以及 value_field 存在。
当我忘记了 facets 查询的一部分,它将查询成功。
有什么想法吗?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题