Skip to content

Instantly share code, notes, and snippets.

@fabianvf
Last active August 29, 2015 14:01
Show Gist options
  • Save fabianvf/fb8ffd17bf5b6f180d88 to your computer and use it in GitHub Desktop.
Save fabianvf/fb8ffd17bf5b6f180d88 to your computer and use it in GitHub Desktop.
Marvel commands for dummy hierarchy in ElasticSearch
GET _search
{
"query": {
"match_all": {}
}
}
DELETE website
PUT website
{
"mappings": {
"project" : {
"name" : {
"type":"string"
},
"pid":{
"type" : "string"
}
},
"wiki" : {
"_parent" : {
"type" : "project"
},
"name": {
"type" : "string"
},
"wid": {
"type":"string"
}
}
}
}
GET website/_mapping
GET website/project/_mapping
GET website/wiki/_mapping
POST website/project/1
{
"name": "Project 1",
"pid": "1"
}
DELETE website/project/1
POST website/wiki/1?parent=1
{
"name" : "Project 1 Wiki",
"wid" : "1"
}
DELETE website/wiki/1
POST website/project/2
{
"name": "Project 2",
"pid": "2"
}
DELETE website/project/2
POST website/wiki/2?parent=2
{
"name" : "Project 2 Wiki",
"wid" : "2"
}
DELETE website/wiki/2
GET _search
{
"query": {
"has_parent" : {
"type": "project"
, "query": {
"match_all": {}
}
}
}
}
GET _search
{
"query": {
"has_child" : {
"type": "wiki"
, "query": {
"match_all": {}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment