1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
| # 删除索引 DELETE my-index-000001 # 创建mapping PUT my-index-000001 { "mappings": { "properties": { "location":{ "type": "geo_shape" }, "circle":{ "type": "geo_shape", "strategy": "recursive" } } } } # 点 POST my-index-000001/_doc { "location": { "type": "point", "coordinates": [ -71.34, 41.12 ] } } # 点 POST /example/_doc { "location" : "POINT (-71.34 41.12)" } # 线 POST my-index-000001/_doc { "location": { "type": "linestring", "coordinates": [ [ -77.03653, 38.897676 ], [ -77.009051, 38.889939 ] ] } } # 线 POST my-index-000001/_doc { "location" : "LINESTRING (-77.03653 38.897676, -77.009051 38.889939)" } # 面 POST my-index-000001/_doc { "location" : { "type" : "polygon", "coordinates" : [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] } } # 面 POST my-index-000001/_doc { "location" : "POLYGON ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0))" } # 多点 POST my-index-000001/_doc { "location" : { "type" : "multipoint", "coordinates" : [ [102.0, 2.0], [103.0, 2.0] ] } } # 多点 POST my-index-000001/_doc { "location" : "MULTIPOINT (102.0 2.0, 103.0 2.0)" } # 多线 POST my-index-000001/_doc { "location" : { "type" : "multilinestring", "coordinates" : [ [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0] ], [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0] ], [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8] ] ] } } # 多线 POST my-index-000001/_doc { "location" : "MULTILINESTRING ((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0), (100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8))" } # 多面 POST my-index-000001/_doc { "location" : { "type" : "multipolygon", "coordinates" : [ [ [[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]] ], [ [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]] ] ] } } # 多面 POST my-index-000001/_doc { "location" : "MULTIPOLYGON (((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0, 102.0 2.0)), ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2)))" }
# 多种集合 POST my-index-000001/_doc { "location" : { "type": "geometrycollection", "geometries": [ { "type": "point", "coordinates": [100.0, 0.0] }, { "type": "linestring", "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] } ] } } # 多种集合 POST my-index-000001/_doc { "location" : "GEOMETRYCOLLECTION (POINT (100.0 0.0), LINESTRING (101.0 0.0, 102.0 1.0))" } # 范围 POST my-index-000001/_doc { "location" : { "type" : "envelope", "coordinates" : [ [100.0, 1.0], [101.0, 0.0] ] } } # 范围 POST my-index-000001/_doc { "location" : "BBOX (100.0, 102.0, 2.0, 0.0)" } # 圆 POST my-index-000001/_doc { "circle" : { "type" : "circle", "coordinates" : [101.0, 1.0], "radius" : "100m" } }
|