gpt4 book ai didi

elasticsearch - Elastic Search query_shard_exception 执行查询失败

转载 作者:行者123 更新时间:2023-11-29 02:55:59 26 4
gpt4 key购买 nike

我想要部分搜索 URL,并且我正在使用以下查询:

GET test/_search
{
"query": {
"bool": {
"must": [{
"query_string": {
"query": "*http://localhost:8000/v3/assets/blt5ed2da305d61b2a2/blt10e8f794fa8597d0/5c481035fecde97033721922b/Screenshot_from_2018-07-30_09-53-42.png*",
"fields": ["url"],
"default_operator": "OR"
}
}]
}
}
}

我收到以下错误:

{
"error": {
"root_cause": [{
"type": "query_shard_exception",
"reason": "Failed to parse query [*http://localhost:8000/v3/assets/blt5ed2da305d61b2a2/blt10e8f794fa8597d0/5c481035fecde97033721922/Screenshot_from_2018-07-30_09-53-42.png*]",
"index_uuid": "ytCEFbRQSmOaIaCXA5Q7LQ",
"index": "test"
}],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [{
"shard": 0,
"index": "test",
"node": "EVRoeO0DTIOQKf95TeA_7g",
"reason": {
"type": "query_shard_exception",
"reason": "Failed to parse query [*http://localhost:8000/v3/assets/blt5ed2da305d61b2a2/blt10e8f794fa8597d0/5c481035fecde97033721922/Screenshot_from_2018-07-30_09-53-42.png*]",
"index_uuid": "ytCEFbRQSmOaIaCXA5Q7LQ",
"index": "test",
"caused_by": {
"type": "parse_exception",
"reason": "Cannot parse '*http://localhost:8000/v3/assets/blt5ed2da305d61b2a2/blt10e8f794fa8597d0/5c481035fecde97033721922/Screenshot_from_2018-07-30_09-53-42.png*': Encountered \" \":\" \": \"\" at line 1, column 5.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n ",
"caused_by": {
"type": "parse_exception",
"reason": "Encountered \" \":\" \": \"\" at line 1, column 5.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <FUZZY_SLOP> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <NUMBER> ...\n "
}
}
}
}]
},
"status": 400
}

你能告诉我这里有什么问题吗?我正在使用 query_string 来搜索 URL,但遇到状态为 400 的上述错误。请帮我解决这个问题。

最佳答案

query string query syntax , 有一些 reserved characters ,即你需要转义的 :/,如下所示:

    "query": "*http\\:\\/\\/localhost\\:8000\\/v3\\/assets\\/blt5ed2da305d61b2a2\\/blt10e8f794fa8597d0\\/5c481035fecde97033721922b\\/Screenshot_from_2018-07-30_09-53-42.png*"

关于elasticsearch - Elastic Search query_shard_exception 执行查询失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54323667/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com