Unexpected character ~ with proximity query

I'm trying to create a proximity query using the docs here

I get an error "reason":"Unexpected character ('~' (code 126)): was expecting comma to separate Object entries" but as far as I can tell, I'm formatting it as specified in the documentation.

The goal is to create a query string proximity query with results having the words "baboon" and "sorry" with a max distance of 5. I can do this with a match phrase and slop, but would like to see how it is done with query string proximity.

Elasticsearch 5.0

curl -X POST -H "Cache-Control: no-cache" -d '{
	"query": {
		"query_string": {
			"fields": ["spoken_words"],
			"query": "baboon sorry"~5
}' "http://localhost:9200/simpsons/_search"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.