1.我们这里通过google自带的工具postman来创建索引,这里我们创建一个:vclogdb,看到返回"acknowledged": true,表示创建成功;
2.通过elasticsearch-head工具可以查看到刚刚创建的vclogdb索引;
3.在已创建索引的情况下,创建类型映射,这里类型为:recordoriginaldata,创建语句:
{ "recordoriginaldata": { "properties": { "duration": { "type": "long" }, "extension": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "calledid": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "fragments": { "properties": { "from": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "text": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "begin": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } } } }, "callerid": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "startrecordtime": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" } } } }
3.在没有创建索引的情况下,创建索引类型映射,这里索引为:vclogdb,类型为:recordoriginaldata,创建语句:
{ "mappings": { "recordoriginaldata": { "properties": { "duration": { "type": "long" }, "extension": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "calledid": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "fragments": { "properties": { "from": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "text": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "begin": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } } } }, "callerid": { "type": "text", "fields": { "keyword": { "ignore_above": 256, "type": "keyword" } } }, "startrecordtime": { "type": "date", "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis" } } } } }
5.删除索引;
扫描二维码关注公众号,回复:
1109195 查看本文章