Skip to content

Instantly share code, notes, and snippets.

@oravecz
Created September 22, 2011 19:10
Show Gist options
  • Select an option

  • Save oravecz/1235719 to your computer and use it in GitHub Desktop.

Select an option

Save oravecz/1235719 to your computer and use it in GitHub Desktop.
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"
}
}}'
@kimchy

kimchy commented Sep 22, 2011

Copy link
Copy Markdown

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 GET needs to come right after the -. Maybe you are not refreshing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment