Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Elasticsearch Proximity/Phrase Search
curl -XDELETE http://localhost:9200/test/articles
curl -XPUT http://localhost:9200/test/_mapping/articles -d '{
"properties": {
"content": {
"type": "string",
"position_offset_gap": 100
}
}
}'
curl -XPOST http://localhost:9200/test/articles/1 -d '{
"content": ["This is a brown fox", "This is white dog"]
}'
curl -XPOST http://localhost:9200/test/articles/2 -d '{
"content": ["This is a brown dog", "The dog is on the table"]
}'
curl -XPOST http://localhost:9200/test/articles/3 -d '{
"content": ["This dog is really brown", "I mean, really really brown"]
}'
curl -XPOST http://localhost:9200/test/articles/4 -d '{
"content": ["The dog is brown but this document is very very long"]
}'
curl -XPOST http://localhost:9200/test/articles/5 -d '{
"content": ["There is also a white cat", "How about a pink elephant?"]
}'
curl -XPOST http://localhost:9200/test/articles/6 -d '{
"content": ["The quick brown fox jumps over the lazy dog"]
}'
curl -XPOST http://localhost:9200/test/articles/1 -d '{
"content": "This is a brown fox"
}'
curl -XPOST http://localhost:9200/test/articles/2 -d '{
"content": "This is a brown dog"
}'
curl -XPOST http://localhost:9200/test/articles/3 -d '{
"content": "This dog is really brown"
}'
curl -XPOST http://localhost:9200/test/articles/4 -d '{
"content": "The dog is brown but this document is very very long"
}'
curl -XPOST http://localhost:9200/test/articles/5 -d '{
"content": "There is also a white cat"
}'
curl -XPOST http://localhost:9200/test/articles/6 -d '{
"content": "The quick brown fox jumps over the lazy dog"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.