我如何在 elasticsearch dsl 查询中使用 kibana 可视化查询?
How can i use kibana visualization query in elasticsearch dsl query?
我真的很高兴使用 kibana 查询通过使用如下过滤来获取数据。
Not why.keyword : "" and target.keyword :"Crystal Sunset Luxury Resort & Spa" and why.keyword : "Kum Plaj,Antalya" and rate >= 0.6
但我决定在 elasticsearch 查询中使用此查询,它会引发错误。如何将上面的 kibana 查询转换为简单的 elasticsearch 查询?
GET /hotelsimilarity-*/_search
{
"query": {
"query_string": {
"query": "Not why.keyword : "" and target.keyword :"Crystal Sunset Luxury Resort & Spa" and why.keyword : "Kum Plaj,Antalya" and rate >= 0.6"
}
}
}
错误:
{
"error": {
"root_cause": [
{
"type": "json_parse_exception",
"reason": "Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@23dd4c9a; line: 4, column: 43]"
}
],
"type": "json_parse_exception",
"reason": "Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@23dd4c9a; line: 4, column: 43]"
},
"status": 500
}
您需要通过 \"
转义您的字符串,或者您可以使用 '
为您的数据加上引号。
{
"query": {
"query_string": {
"query": "Not why.keyword : '' and target.keyword :'Crystal Sunset Luxury Resort & Spa' and why.keyword : 'Kum Plaj,Antalya' and rate >= 0.6"
}
}
}
错误主要与improper JSON format
有关,由mixing " in the query with " in the data
引起
我真的很高兴使用 kibana 查询通过使用如下过滤来获取数据。
Not why.keyword : "" and target.keyword :"Crystal Sunset Luxury Resort & Spa" and why.keyword : "Kum Plaj,Antalya" and rate >= 0.6
但我决定在 elasticsearch 查询中使用此查询,它会引发错误。如何将上面的 kibana 查询转换为简单的 elasticsearch 查询?
GET /hotelsimilarity-*/_search
{
"query": {
"query_string": {
"query": "Not why.keyword : "" and target.keyword :"Crystal Sunset Luxury Resort & Spa" and why.keyword : "Kum Plaj,Antalya" and rate >= 0.6"
}
}
}
错误:
{
"error": {
"root_cause": [
{
"type": "json_parse_exception",
"reason": "Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@23dd4c9a; line: 4, column: 43]"
}
],
"type": "json_parse_exception",
"reason": "Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@23dd4c9a; line: 4, column: 43]"
},
"status": 500
}
您需要通过 \"
转义您的字符串,或者您可以使用 '
为您的数据加上引号。
{
"query": {
"query_string": {
"query": "Not why.keyword : '' and target.keyword :'Crystal Sunset Luxury Resort & Spa' and why.keyword : 'Kum Plaj,Antalya' and rate >= 0.6"
}
}
}
错误主要与improper JSON format
有关,由mixing " in the query with " in the data