Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.42 KB | None | 0 0
  1. DELETE /gangs
  2.  
  3. GET /gangs
  4.  
  5. PUT /gangs
  6. {
  7.   "settings": {
  8.     "index.mapping.coerce": false,
  9.     "index.mapper.dynamic": false
  10.   },
  11.   "mappings": {
  12.     "gang": {
  13.       "properties": {
  14.         "name": {
  15.           "type": "keyword"
  16.         },
  17.         "description": {
  18.           "type": "text"
  19.         }
  20.       }
  21.     },
  22.     "territory": {
  23.       "_parent": {
  24.         "type": "gang"
  25.       },
  26.       "properties": {
  27.         "name": {
  28.           "type": "keyword"
  29.         },
  30.         "coordinate": {
  31.           "type": "object",
  32.           "properties": {
  33.             "x":  { "type": "integer" },
  34.             "y":  { "type": "integer" }
  35.           }
  36.         }
  37.       }
  38.     },
  39.     "entity": {
  40.       "_parent": {
  41.         "type": "gang"
  42.       },
  43.       "properties": {
  44.         "name": {
  45.           "type": "keyword"
  46.         }
  47.       }
  48.     }
  49.   }
  50. }
  51.  
  52. PUT /gangs/gang/gang1?refresh=true
  53. {
  54.   "name": "test1"
  55. }
  56.  
  57. PUT /gangs/gang/gang2?refresh=true
  58. {
  59.   "name": "test2"
  60. }
  61.  
  62. PUT /gangs/territory/territory1?parent=gang1&refresh=true
  63. {
  64.   "name": "territory1",
  65.   "coordinate": {
  66.     "x": 10,
  67.     "y": 11
  68.   }
  69. }
  70.  
  71. GET /gangs/_search
  72. {
  73.   "query": {
  74.     "parent_id" : {
  75.       "type" : "gang",
  76.       "id" : "gang1"
  77.     }
  78.   }
  79. }
  80.  
  81. GET /gangs/_search
  82. {
  83.   "query": {
  84.     "has_parent": {
  85.       "parent_type": "gang",
  86.         "query": {
  87.           "term": {
  88.             "_id": "gang1"
  89.         }
  90.       }
  91.     }
  92.   }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement