使用 Kibana 来搜索,查看存储在 Elasticsearch 索引中的数据并与之交互。
直接建索引表和表结构
PUT /month_index?pretty {
"settings": {
"number_of_shards": "5",
"number_of_replicas": "1"
},
"mappings": {
"wxMsg": {
"properties": {
"content": {
"type": "text"
},
"createTime": {
"type": "long"
},
"flag": {
"type": "integer"
},
"imgPath": {
"type": "keyword"
},
"transfer": {
"type": "nested",
"properties": {
"payTpye": {
"type": "integer"
},
"fee": {
"type": "double"
},
"transId": {
"type": "text"
},
"transferId": {
"type": "text"
},
"invalidTime": {
"type": "long"
},
"beginTime": {
"type": "long"
},
"effectiveDate": {
"type": "text"
},
"memo": {
"type": "text"
},
"payMsgId": {
"type": "text"
}
}
}
}
}
}
}
删除索引表
DELETE month_index
根据条件搜索并分页
GET month_index / wxMsg / _search {
"from": 0,
"size": 100,
"query": {
"match_phrase": {
"flag": "419430449"
}
}
}
查询结果进行排序
GET month_index/wxMsg/_search
{
"query": {
"match_all": {}
},
"sort": {"createTime": {"order": "desc"}}
}
查看表结构
GET month_index/wxMsg/_mapping
查看字符串是怎么分词
GET /_analyze
{
"analyzer": "standard",
"text": "13866123123查看是怎样分词的哦呦"
}
修改现有表字段类型
PUT month_index/wxMsg/_mapping
{
"properties":{
"content" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
查询全部数据
GET month_index/wxMsg/_search
{
"query": {
"match_all": {}
}
}