Elastic search intervals query

TEXT : A simple sentence contains only one independent clause

I want the query to return proximity search.

Simple w/3 one -> I need to return the above text documents.

request body : { "query": {
"intervals" : {
"Title" : {
"all_of" : {
"ordered" : true,
"intervals" : [
{
"match" : {
"query" : "Automation Regression",
"max_gaps" : 2,
"ordered" : true
}
},
{
"any_of" : {
"intervals" : [
{ "match" : { "query" : "New" } }
]
}
}
]
}
}
}
}
}

I want output : "Title": "Automation Regression Checklist for New

I was trying to get results from U.I . If i search Title(Automatic Regression W/2 new) i need to get documents which contain Automatic Regression vamsi to new(any two words with the two phrases).

How Do I Use Proximity Searching to find a Phrase Within 10 words of Another Phrase or Word?

Have you looked the the documentation and examples for span queries?

i tried this but anything above the interval number giving the results.

{

"query": {

  "query_string": {

     "fields" : ["Title"],

     "query": "\"Automation new\"~4"

  }

}

}

"Title": "Automation Regression Checklist for New Iteration",

{

"query": {

  "query_string": {

     "fields" : ["Title"],

     "query": "\"Automation new\"~4"

  }

}

}

Anything value above three returning results but i need the value to return only for number 3 but not for 4.

can we achieve this scenario using intervals query? input is two phrases and proximity number.