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 165
| #新建索引 PUT /索引名称 { "settings": { "index": { "refresh_interval": "300s", "number_of_shards":"5", "number_of_replicas":"1" } } }
#新建索引映射 POST /索引名称/_mapping/type { "dynamic": "false", "properties": { "name": { "type": "keyword" }, "actualOperationTime": { "type": "text" }, "areaHectare": { "type": "double" } "landUser": { "type": "text", "analyzer": "ik_max_word", #ik_max_word: 最细粒度的拆分 ik_smart:最粗粒度的拆分 "fields": { "raw": { "type": "keyword" } } } } }
#查看Mapping GET 索引名/_mapping
#查询所有 GET _search { "query": { "match_all": {} } }
#查询指定索引并按某个字段排序 POST 索引名/type/_search { "from": 0, "size": 20 , "query": { "term": { "company.raw":"xxx有限公司" } } , "sort": [ { "createTime": { "order": "desc" } } ] }
#多条件查询 GET 索引名称/type/_search { "query": { "bool": { "must": [ { "match": { "eid": "3A6D580B625E438DAE972500A8C46152" } }, { "match":{ "type":"身份证" } } ] } } }
#聚合分组查询 POST 索引/type/_search { "size": 0, "aggs": { "gropCompanyName":{ #名称任意自定义 "terms": { "field": "fieldName", "min_doc_count": 1, "size": 10 } } } }
#索引Copy POST _reindex { "source": { "index": "原索引名称" }, "dest": { "index": "目标索引名称", "op_type": "create" } }
#某个字段时间区间查询 GET 索引/type/_search { "from": 0, "size": 20, "query": { "range": { "createTime": { "gte": "2020-06-03", "lte": "2020-06-05" } } } }
#过滤某个为空的字段 GET 索引/type/_search { "query": { "bool": { "must": [ { "term": { "field": "value" } },{ "constant_score": { "filter": { "exists": { "field": "cs_jydz" } } } } ] } } }
#根据指定id删除记录 DELETE 索引/type/id
#根据条件删除 POST 索引/_delete_by_query { "query": { #删除条件 } }
|