gpt4 book ai didi

json - Elasticsearch “span and”

转载 作者:行者123 更新时间:2023-12-02 22:39:37 25 4
gpt4 key购买 nike

我有一个elasticsearch查询:

"query": {
"bool": {
"minimum_should_match": 1,
"should": {
"span_not": {
"exclude": {
"span_or": {
"clauses": [{
"span_near": {
...
},
"span_near": {
...
}
}]
}
}...

我需要在include子句中添加以下内容:
"span_or": {
clauses: [
{
"span_near": {...}
}
,
{
"span_and": {
"clases": [
{
"span_near": {...}
}
,
{
"span_near": {...}
}
,
...
]
}
}
]

}

我的意思是,我有“或”查询:
(span_near or span_near or span_near or ...)

我想得到“和”查询:
(span_near or (span_near and span_near) or ...)

我该怎么做?没有标签“span_and”。我可以改用什么标签?

更新1

我已经试过了:
"span_or": {
clauses: [
{
"span_multi": {
"match": {
"regexp": {
"message": "путин.*"
}
}
}
}
,
{
"span_multi": {
"match": {
"bool": {
"must": [
{
"term" : { "message" : "test" }
},
{
"term" : { "message" : "rrr" }
}
]
}
}
}
}
]
}

但我有一个错误:

spanMultiTerm [match] must be of type multi term query

最佳答案

普通的bool查询可以解决您的问题吗?

{
"query": {
"bool": {
"must_not": {
"bool": {
"should": [
{
"regexp":{
"message": "путин.*"
}
},
{
"bool": {
"must": [
{
"span_near": {...}
},
{
"span_near": {...}
}
]
}
}
]
}
}
}
}
}

关于json - Elasticsearch “span and”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36908850/

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