首页 > 其他分享 >添加es的mapping与setting

添加es的mapping与setting

时间:2022-12-05 15:12:36浏览次数:36  
标签:index 请求 mapping window setting type es 9200

一:建立索引

请求方式:put

 

请求url:

127.0.0.1:9200/rain_run_index

 

请求体:

{
    "mappings":{
        "properties":{
            "deviceNo":{
                "type":"text",
                "fields":{
                    "keyword":{
                        "type":"keyword",
                        "ignore_above":256
                    }
                }
            },
            "customerId":{
                "type":"long"
            },
            "rainValue":{
                "type":"double"
            },
            "createTime":{
                "type":"date",
                "format":"yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
            }
        }
    },
    "settings":{
        "number_of_shards":"3",
        "number_of_replicas":"1",
        "translog":{
            "durability":"async"
        }
    }
}

 

二:window大小调整

1.说明

  按照正常情况,from,size的大小是10000,如果刚好12000条数据,可以修改下window的大小

 

2.设置setting

  请求url:

put http://127.0.0.1:9200/rain_area_index/_settings

  请求体:

{
    "index.max_result_window":"100000"
}

 

标签:index,请求,mapping,window,setting,type,es,9200
From: https://www.cnblogs.com/juncaoit/p/16952321.html

相关文章