Intervals query with or operator

Hello,
is it possible to use intervals query with an OR operator logic without using a list of match queries with any_of rule?

I want to use the intervals positional score for a set of terms, but without the need to loop through each term to construct the query, as I need to pass it as a string parameter in my constructor.

Example:

{
    "intervals": {
        "title": {
            "any_of": { #or
                "intervals": [
                    {"match": {"query": "smartphone samsung"}},
                    {"match": {"query": "smartphone xiaomi"}}
                ]
            }
        }
    }
}

This query gives me the result I want, but I need to pass the terms as one single string query, like

{
    "intervals": {
        "title": {
            "match": {
                "ordered": false,
                "query": "smartphone samsung xiaomi",
                "operator": "or" #<<<<<
            }
        }
    }
}

Thanks in advance

1 Like

intervals query syntax
{
"intervals":
{
"FilterKeys":
{
"all_of":
{
"ordered": true,
"max_gaps": 5,
"intervals":
[
{
"match":
{
"query": "hello word",
"max_gaps": 0,
"ordered": true
}
},
{
"match":
{
"query": "how to",
"max_gaps": 0,
"ordered": true
}
}
]
},
"boost": 1
}
}
}

intervals_phrase syntax
{
"intervals_phrase":{
"query":"((hello word)~0 (how to)~0)~5",
"field":"FilterKeys",
"ordered":"true"
}
}