Created
February 8, 2015 17:57
-
-
Save bonzanini/e1a330b9e2c3e44c442c to your computer and use it in GitHub Desktop.
Elasticsearch Proximity/Phrase Search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | |
}' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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