Skip to content

Instantly share code, notes, and snippets.

@martijnvg
Created January 3, 2013 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martijnvg/4442042 to your computer and use it in GitHub Desktop.
Save martijnvg/4442042 to your computer and use it in GitHub Desktop.
curl -XDELETE 'localhost:9200/prototype_2013.01.03?pretty'
echo
curl -XPUT 'localhost:9200/prototype_2013.01.03?pretty' -d '{
"mappings" : {
"chow-clfg" : {
"dynamic" : "true",
"_source" : {
"enabled" : true
},
"_ttl" : {
"enabled" : true,
"default" : "30m"
},
"properties" : {
"clfg" : {
"analyzer" : "keyword",
"type" : "string"
},
"count" : {
"type" : "long"
}
},
"_parent" : {
"type" : "chow-demo"
}
},
"chow-demo" : {
"properties" : {
"clfg" : {
"analyzer" : "keyword",
"type" : "string"
},
"httpcode" : {
"type" : "long"
},
"timestamp" : {
"type" : "string"
},
"user_agent" : {
"analyzer" : "keyword",
"type" : "string"
}
}
}
}
}'
echo
curl -XPUT 'localhost:9200/prototype_2013.01.03/chow-demo/IZFN7tQSWiD9lwFrrKCTw?pretty' -d '{
"httpcode" : 200,
"clfg" : "Cg5iU1BHZ88kAAAAYAE",
"user_agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17 -"
}'
echo
curl -XPUT 'localhost:9200/prototype_2013.01.03/chow-clfg/PybhISPURJS5q5DbQMEnTA?parent=IZFN7tQSWiD9lwFrrKCTw&pretty' -d '{
"clfg" : "Cg5iU1BHZ88kAAAAYAE",
"count" : 1
}'
echo
curl -XPOST 'localhost:9200/_refresh?pretty'
echo
curl -XPOST 'localhost:9200/prototype_2013.01.03/chow-demo/_search?pretty' -d '{
"query": {
"has_child": {
"type": "chow-clfg",
"query": {
"term": {
"clfg": "Cg5iU1BHZ88kAAAAYAE"
}
}
}
}
}'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment