ES 7.7..0 版本:
例子1:
put voucher_record_idx
{
"settings": {
"analysis": {
"analyzer": {
"default": {
"type": "ik_max_word"
}
}
}
},
"mappings": {
"properties": {
"id": {
"type": "long"
},
"couponId": {
"type": "long"
},
"orderId": {
"type": "long"
},
"shopId": {
"type": "long"
},
"useNumber": {
"type": "long"
},
"useUid": {
"type": "long"
},
"couponCode": {
"type": "text",
"analyzer": "keyword"
},
"couponType": {
"type": "long"
},
"remarks": {
"type": "text"
},
"collectCouponsId": {
"type": "long"
},
"paymentAmount": {
"type": "double"
},
"createTime": {
"type": "long"
}
}
}
}
----------------------------------------------
------------------创建别名,用别名来搜索----------------------------
POST /_aliases?pretty
{
"actions": [
{
"add": {
"index": "voucher_record_idx",
"alias": "voucher_record_form"
}
}
]
}
------------------创建别名,用别名来搜索----------------------------
------------------一个别名,关联多个索引----------------------------
POST /_aliases?pretty
{
"actions": [
{
"add": {
"index": "visitor_logs_2017",
"alias": "visitor_logs"
}
},
{
"add": {
"index": "visitor_logs_2018",
"alias": "visitor_logs"
}
}
]
}
例子2:
put user_article_idx
{
"settings": {
"analysis": {
"analyzer": {
"default": {
"type": "ik_max_word"
}
}
}
},
"mappings": {
"properties": {
"id":{
"type":"long"
},
"name":{
"type": "text"
},
"age":{
"type":"long"
},
"artId":{
"type":"long"
},
"title":{
"type": "text"
},
"expert":{
"type": "text"
},
"author_id":{
"type":"long"
},
"created": {
"type": "date"
}
}
}
}
设置可查询的条数:
put kibana_sample_data_logs/_settings
{
"index":{
"max_result_window":20000
}
}