gpt4 book ai didi

elasticsearch - Elasticsearch “query_string”查询错误显示为 “Lexical error”

转载 作者:行者123 更新时间:2023-12-02 23:50:31 24 4
gpt4 key购买 nike

应用程序版本
Elasticsearch:v.7.1
Laravel:v5.8

操作系统版本:Ubuntu 18(服务器)/ Windows 10(开发PC)

Elasticsearch搜索API的“query_string”查询返回诸如“Lexical error”之类的错误消息-告诉查询中存在错误。

重现的步骤:

一种。我们使用的“query_string”查询包含 4629个字符(包括字母和符号,例如括号和双引号)
b。当我们使用PHP和Python应用程序进行查询时,会弹出标题中提到的错误


主要问题

我是在这里做错什么,还是应用程序级错误/错误?一直在尝试使用“simple_query_string”之类的替代方法,但是它具有不同的行为,因此我们非常热衷于使用Elasticsearch的 query_string 查询

这是查询

"query_string" => [
"fields" => ['title', 'content'],
"query" => """
(("Salvador "Sal" San Buenaventura Panelo")) OR ("Christopher Lawrence Go") OR ("DILG Undersecretary Epimaco Densing") OR ("Rodolfo Fariñas") OR ("Francis Tolentino" AND ("De Lima" OR "Leila De Lima")) OR ("Reynaldo V. Umali" AND ("De Lima" OR "Leila De Lima")) OR ("Bong Revilla") OR (("Jose "Joe" Callangan Calida")) OR ("Gus S. Tambunting" OR "GusTambunting" AND ("De Lima" OR "Leila De Lima")) OR ("Ramon Bong Revilla" OR "Bong Revilla" AND ("De Lima" OR "Leila De Lima")) OR (Lacson) OR ("Francis Ng Tolentino") OR ("Jose Calida") OR ("José Ruperto Martín Marfori Andanar") OR ("Prospero Pichay Jr.") OR ("Pantaleon Alvarez" AND ("De Lima" OR "Leila De Lima")) OR ("Prospero Pichay" AND ("De Lima" OR "Leila De Lima")) OR ("Senator Vicente Sotto") OR ("Paolo "Pulong" Zimmerman Duterte") OR ("Prospero Arreza Pichay Jr.") OR ("Rudy Fariñas" AND ("De Lima" OR "Leila De Lima")) OR ("Paolo Duterte") OR ("Rudy Fariñas") OR ("Fredenil Castro") OR ("Salvador B. Belaro Jr.") OR ("Sen. Imee Marcos") OR ("Manny Pacquiao") OR ("Senator Aquilino "Koko" Pimentel III" OR "Sen. Aquilino "Koko" Pimentel III") OR ("Senator Aquilino Pimentel III" OR "Sen. Aquilino Pimentel III" OR "Senator Aquilino Pimentel") OR ("Senator Vicente C. Sotto III") OR ("Tito Sotto") OR ("Bato dela Rosa") OR ("Sen. Bato") OR ("Hon. Reynaldo V. Umali") OR ("Gus S. Tambunting") OR ("Tito Sotto" OR "Senator Vicente Sotto" AND ("De Lima" OR "Leila De Lima")) OR ("Bato dela Rosa" OR "Senator Ronald "Bato" dela Rosa"("De Lima" OR "Leila De Lima")) OR ("Bong Go" OR "Christopher Lawrence Go" AND ("De Lima" OR "Leila De Lima")) OR ("Paolo Duterte" AND ("De Lima" OR "Leila De Lima")) OR ("Fredenil H. Castro" OR "Fredenil Castro" AND ("De Lima" OR "Leila De Lima")) OR ("Koko Pimentel") OR ("Paolo Zimmerman Duterte") OR ("Pantaleon Diaz Alvarez") OR ("Salvador Belaro" AND ("De Lima" OR "Leila De Lima")) OR ("Ramon Revilla") OR ("Senator Bong Go") OR (Panfilo) OR ("Jose Callangan Calida") OR ("Salvador San Buenaventura Panelo") OR ("Pantaleon "Bebot" Diaz Alvarez") OR ("Fredenil H. Castro" OR "Fredenil Castro") OR ("Salvador Belaro Jr.") OR ("Salvador Belaro") OR ("Reynaldo V. Umali") OR ("Senator Koko Pimentel III) OR ("Sen. AND Koko AND Pimentel AND III" OR "Sen. AND Koko AND Pimentel") OR ("Bong AND Go") OR ("Ramon AND Bong AND Revilla") OR ("Senator AND Panfilo AND Lacson" OR "Panfilo AND Lacson" OR "Ping AND Lacson" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Manny AND Pacquiao" OR "Senator AND Manny AND Pacquiao" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Salvador AND Panelo" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Epimaco AND Densing" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Senator AND Sotto") OR ("Vicente AND Sotto") OR ("Panfilo AND Lacson" OR "Ping AND Lacson") OR ("Ronald AND dela AND Rosa") OR ("Senator AND Revilla") OR ("Prospero AND Pichay") OR ("Jose AND Calida" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Senator AND Francis AND Tolentino") OR ("Senator AND Ronald AND dela AND Rosa") OR ("Menardo AND Guevarra" OR "Menardo AND I. AND Guevarra") OR ("Rodolfo AND "Rudy" AND Castro AND Fariñas") OR ("Senator AND Imee AND Marcos" OR "Imee AND Marcos" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Gus AND S. AND Tambunting" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Ronald AND “Bato” AND dela AND Rosa") OR ("Senator AND Bato AND dela AND Rosa") OR ("Senator AND Ramon AND Revilla AND Jr.") OR ("Sen. AND Francis AND Tolentino") OR ("Francis AND Tolentino") OR (("María AND Imelda AND Josefa AND "Imee" AND Romualdez AND Marcos")) OR ("Pulong AND Duterte") OR ("Rodolfo AND Castro AND Fariñas") OR ("Menardo AND Guevarra" OR "Menardo AND I. AND Guevarra"("De AND Lima" OR "Leila AND De AND Lima")) OR ("Christopher AND Lawrence AND “Bong” AND Go") OR ("Senator AND Imee AND Marcos") OR ("Justice AND Secretary AND Menardo AND Guevarra" OR "Justice AND Secretary AND Menardo AND I. AND Guevarra") OR ("Epimaco AND Densing") OR ("Fredenil AND "Fred" AND H. AND Castro") OR ("Koko AND Pimentel" OR "Senator AND Aquilino AND Pimentel AND III" OR "Sen. AND Aquilino AND Pimentel AND III" OR "Senator AND Aquilino AND Pimentel" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Martín AND Andanar" ("De AND Lima" OR "Leila AND De AND Lima")) OR ("Senator AND Ronald AND "Bato" AND dela AND Rosa") OR ("Christopher AND Lawrence AND "Bong" AND Tesoro AND Go") OR ("Senator AND Christopher AND Lawrence AND "Bong" AND Tesoro AND Go") OR ("Senator AND Panfilo AND Lacson") OR ("Senator AND Manny AND Pacquiao") OR ("Salvador AND Panelo") OR ("Martín AND Andanar") OR ("Pantaleon AND Alvarez")
"""

最佳答案

删除""中的双引号(query),然后尝试如下操作,希望它以后可以使用。

关于我的索引的工作示例:

GET locations/_search
{
"size": 1,
"sort": [
{
"_score": {
"order": "desc"
}
},
{
"property_count": {
"order": "desc"
}
}
],
"query": {
"bool": {
"must": [
{
"match": {
"country_code.keyword": "IT"
}
},
{
"query_string": {
"fields": ["display","content"],
"query": "((Salvador Sal San Buenaventura Panelo)) OR (Christopher Lawrence Go) OR (DILG Undersecretary Epimaco Densing) OR (Rodolfo Fariñas) OR (Francis Tolentino AND (De Lima OR Leila De Lima)) OR (Reynaldo V. Umali AND (De Lima OR Leila De Lima)) OR (Bong Revilla) OR ((Jose Joe Callangan Calida)) OR (Gus S. Tambunting OR GusTambunting AND (De Lima OR Leila De Lima)) OR (Ramon Bong Revilla OR Bong Revilla AND (De Lima OR Leila De Lima)) OR (Lacson) OR (Francis Ng Tolentino) OR (Jose Calida) OR (José Ruperto Martín Marfori Andanar) OR (Prospero Pichay Jr.) OR (Pantaleon Alvarez AND (De Lima OR Leila De Lima)) OR (Prospero Pichay AND (De Lima OR Leila De Lima)) OR (Senator Vicente Sotto) OR (Paolo Pulong Zimmerman Duterte) OR (Prospero Arreza Pichay Jr.) OR (Rudy Fariñas AND (De Lima OR Leila De Lima)) OR (Paolo Duterte) OR (Rudy Fariñas) OR (Fredenil Castro) OR (Salvador B. Belaro Jr.) OR (Sen. Imee Marcos) OR (Manny Pacquiao) OR (Senator Aquilino Koko Pimentel III OR Sen. Aquilino Koko Pimentel III) OR (Senator Aquilino Pimentel III OR Sen. Aquilino Pimentel III OR Senator Aquilino Pimentel) OR (Senator Vicente C. Sotto III) OR (Tito Sotto) OR (Bato dela Rosa) OR (Sen. Bato) OR (Hon. Reynaldo V. Umali) OR (Gus S. Tambunting) OR (Tito Sotto OR Senator Vicente Sotto AND (De Lima OR Leila De Lima)) OR (Bato dela Rosa OR Senator Ronald Bato dela Rosa(De Lima OR Leila De Lima)) OR (Bong Go OR Christopher Lawrence Go AND (De Lima OR Leila De Lima)) OR (Paolo Duterte AND (De Lima OR Leila De Lima)) OR (Fredenil H. Castro OR Fredenil Castro AND (De Lima OR Leila De Lima)) OR (Koko Pimentel) OR (Paolo Zimmerman Duterte) OR (Pantaleon Diaz Alvarez) OR (Salvador Belaro AND (De Lima OR Leila De Lima)) OR (Ramon Revilla) OR (Senator Bong Go) OR (Panfilo) OR (Jose Callangan Calida) OR (Salvador San Buenaventura Panelo) OR (Pantaleon Bebot Diaz Alvarez) OR (Fredenil H. Castro OR Fredenil Castro) OR (Salvador Belaro Jr.) OR (Salvador Belaro) OR (Reynaldo V. Umali) OR (Senator Koko Pimentel III) OR (Sen. AND Koko AND Pimentel AND III OR Sen. AND Koko AND Pimentel) OR (Bong AND Go) OR (Ramon AND Bong AND Revilla) OR (Senator AND Panfilo AND Lacson OR Panfilo AND Lacson OR Ping AND Lacson (De AND Lima OR Leila AND De AND Lima)) OR (Manny AND Pacquiao OR Senator AND Manny AND Pacquiao (De AND Lima OR Leila AND De AND Lima)) OR (Salvador AND Panelo (De AND Lima OR Leila AND De AND Lima)) OR (Epimaco AND Densing (De AND Lima OR Leila AND De AND Lima)) OR (Senator AND Sotto) OR (Vicente AND Sotto) OR (Panfilo AND Lacson OR Ping AND Lacson) OR (Ronald AND dela AND Rosa) OR (Senator AND Revilla) OR (Prospero AND Pichay) OR (Jose AND Calida (De AND Lima OR Leila AND De AND Lima)) OR (Senator AND Francis AND Tolentino) OR (Senator AND Ronald AND dela AND Rosa) OR (Menardo AND Guevarra OR Menardo AND I. AND Guevarra) OR (Rodolfo AND Rudy AND Castro AND Fariñas) OR (Senator AND Imee AND Marcos OR Imee AND Marcos (De AND Lima OR Leila AND De AND Lima)) OR (Gus AND S. AND Tambunting (De AND Lima OR Leila AND De AND Lima)) OR (Ronald AND “Bato” AND dela AND Rosa) OR (Senator AND Bato AND dela AND Rosa) OR (Senator AND Ramon AND Revilla AND Jr.) OR (Sen. AND Francis AND Tolentino) OR (Francis AND Tolentino) OR ((María AND Imelda AND Josefa AND Imee AND Romualdez AND Marcos)) OR (Pulong AND Duterte) OR (Rodolfo AND Castro AND Fariñas) OR (Menardo AND Guevarra OR Menardo AND I. AND Guevarra(De AND Lima OR Leila AND De AND Lima)) OR (Christopher AND Lawrence AND “Bong” AND Go) OR (Senator AND Imee AND Marcos) OR (Justice AND Secretary AND Menardo AND Guevarra OR Justice AND Secretary AND Menardo AND I. AND Guevarra) OR (Epimaco AND Densing) OR (Fredenil AND Fred AND H. AND Castro) OR (Koko AND Pimentel OR Senator AND Aquilino AND Pimentel AND III OR Sen. AND Aquilino AND Pimentel AND III OR Senator AND Aquilino AND Pimentel (De AND Lima OR Leila AND De AND Lima)) OR (Martín AND Andanar (De AND Lima OR Leila AND De AND Lima)) OR (Senator AND Ronald AND Bato AND dela AND Rosa) OR (Christopher AND Lawrence AND Bong AND Tesoro AND Go) OR (Senator AND Christopher AND Lawrence AND Bong AND Tesoro AND Go) OR (Senator AND Panfilo AND Lacson) OR (Senator AND Manny AND Pacquiao) OR (Salvador AND Panelo) OR (Martín AND Andanar) OR (Pantaleon AND Alvarez)"
}
}
]
}
},
"_source": [
"location_id",
"display",
"parent_path",
"parent_location_id",
"country",
"country_code",
"east",
"west",
"north",
"south",
"category"
]
}

查看示例: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-query-ex-request

关于elasticsearch - Elasticsearch “query_string”查询错误显示为 “Lexical error”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58024791/

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