Created
May 28, 2012 13:40
-
-
Save forste/2819256 to your computer and use it in GitHub Desktop.
default put, get, delete
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 -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ | |
"user" : "kimchy", | |
"post_date" : "2009-11-15T14:12:12", | |
"message" : "trying out Elastic Search" | |
}' | |
//shows data from above | |
curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{ | |
query : { | |
bool : { | |
should : [ | |
{ | |
matchAll : {} | |
} | |
], | |
must: [ | |
{ | |
text: { | |
user : { | |
query: "kimchy", | |
operator: "and" | |
} | |
} | |
} | |
] | |
} | |
} | |
}' | |
curl -XDELETE 'http://localhost:9200/twitter/tweet/_query' -d '{ | |
"term" : { "user" : "kimchy" } | |
}' | |
//tweet is deleted | |
curl -XGET 'http://localhost:9200/twitter/tweet/_search' -d '{ | |
query : { | |
bool : { | |
should : [ | |
{ | |
matchAll : {} | |
} | |
], | |
must: [ | |
{ | |
text: { | |
user : { | |
query: "kimchy", | |
operator: "and" | |
} | |
} | |
} | |
] | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment