Query with OR and AND clauses

I want to realize query like this:

(span_near or (span_near and span_near) or ...).

I have tried:
> "span_or": {

                                clauses: [
                                {
                                    "span_multi": {
                                        "match": {
                                            "regexp": {
                                                "message": "ttt"
                                            }
                                        }
                                    }
                                }
                                ,
                                {
                                    "span_multi": {
                                        "match": {
                                            "bool": {
                                                "must": [
                                                    {
                                                        "term" : { "message" : "test" }
                                                    },
                                                    {
                                                        "term" : { "message" : "rrr" }
                                                    }
                                                ]
                                            }
                                        }
                                    }
                                }
                                ]
                            }

but it returns me a error:

spanMultiTerm [match] must be of type multi term query

Hi,

as mentioned here span_multi can only wrap term, range, prefix, wildcard, regexp or fuzzy query. Why do you need span_multi in the second clause? Can't you simply use span_term query and combine them in a span_near?

I need query:

(span_near or (span_near and span_near) or ...).

Something like this:

"span_or": {
clauses: [
{
"span_near": {... }
}
,
{
"span_and": {
"clauses": [
{
"span_near": {...}
}
,
{
"span_near": {...}
}
,
...
]
}
}
]
}

Hi,
instead if you combine two span_near queries with a large slop inside another span_near query you might get what you need. Its hard to tell because your use case still isn't quiet clear to me. I wonder why you need all that and/or logic with span-queries. Can't you simply use one or more bool queries at the top level and then use the individual span_near queries inside it?