Created
September 22, 2011 19:10
-
-
Save oravecz/1235719 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 -PUT 'http://localhost:9320/my_twitter1/' -d '{ | |
| { | |
| "settings": { | |
| "number_of_shards": 1, | |
| "number_of_replicas": 0 | |
| }, | |
| "mappings": { | |
| "tweet" : { | |
| "properties" : { | |
| "user" : {"type" : "string", "index" : "not_analyzed"}, | |
| "message" : {"type" : "string", "null_value" : "na", "index" : "analyzed", "analyzer" : "whitespace"}, | |
| "postDate" : {"type" : "date"} | |
| } | |
| } | |
| } | |
| }' | |
| curl -PUT 'http://localhost:9320/my_twitter1/tweet/1' -d '{ | |
| "user" : "kimchy", | |
| "post_date" : "2011-09-20T16:20:00", | |
| "message" : "I was trying to use elastic search" | |
| }' | |
| curl - GET 'http://localhost:9320/my_twitter1/_search?pretty=true' -d '{ | |
| "query": { | |
| "query_string": { | |
| "default_field": "message", | |
| "query": "was" | |
| } | |
| }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, this works fine for me. The code you pasted has several structure problems, the first creation of the index is a malformed json, and the last request the
GETneeds to come right after the-. Maybe you are not refreshing?