elasticsearch中的多个索引

时间:2018-01-03 07:52:36

标签: elasticsearch spring-data-elasticsearch

根据我的要求,我必须在每天的标签视图中向客户显示七天的数据,并且每天的数据与其他日期数据(如price / quantity_in_hand等)不同。以下是1天的样本。相同的SKU将以不同的数量/价格和可用数据重复。

我的问题是,我是否需要提前每天创建一个索引,因为每天数据都在变化,或者是否有其他方法可以有效地完成。

    "sku": [
    {
        "storeId": 10101,
        "storeName": "Store-1",
        "skuId": 10142,
        "skuName": "SkuName1",
        "storeSalePrice": 10.0,
        "currencySymobol": "$",
        "minQTY": 1,
        "maxQty": 1000,
        "description": "QWERTYUIOP{",
        "productId": 10142,
        "longDescription": "QWERTYUIOPOUYSDFGHJKXCVBNMDFGHJXGHJXCVBNM",
        "location": {
            "lat": 37.565359,
            "lon": -122.042346
        },
        "categoryTypeName": "categoryTypeName",
        "skuSearchKeyWords": "LKJKL,SDFDSF,ERWER,SDFDSF,AFAF,AF,DF,ASDF",
        "skuAvailabilityDate": "2018-01-02"
    },
    {
        "storeId": 10101,
        "storeName": "Store-1",
        "skuId": 10142,
        "skuName": "SkuName1",
        "storeSalePrice": 10.0,
        "currencySymobol": "$",
        "minQTY": 1,
        "maxQty": 1000,
        "description": "QWERTYUIOP{",
        "productId": 10142,
        "longDescription": "QWERTYUIOPOUYSDFGHJKXCVBNMDFGHJXGHJXCVBNM",
        "location": {
            "lat": 37.565359,
            "lon": -122.042346
        },
        "categoryTypeName": "categoryTypeName",
        "skuSearchKeyWords": "LKJKL,SDFDSF,ERWER,SDFDSF,AFAF,AF,DF,ASDF",
        "skuAvailabilityDate": "2018-01-02"

    }
]

1 个答案:

答案 0 :(得分:0)

您可以使用索引名称模式创建模板,然后首先将文档插入到新的一天,将根据模板创建具有模式的索引。
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html