Use existing field as id in elasticsearch

前端 未结 1 911
旧巷少年郎
旧巷少年郎 2021-01-12 04:52

Just started using elasticSearch today. I was wondering if it would be possible to set in some kind of global parameter to use a certain field within a document as the ID al

相关标签:
1条回答
  • 2021-01-12 05:21

    You want to use the path setting, see the docs here:

    http://www.elasticsearch.org/guide/reference/mapping/id-field/

    specifically something like this should work in your mapping:

    {
        "your_mapping" : {
            "_id" : {
                "path" : "Record ID"
            }
        }
    }
    

    I've never tried having variable names split up though. You might want to camelcase or underscore them if you run into wierdness.

    0 讨论(0)
提交回复
热议问题