在ElasticSearch中将组合字段用作ID映射 [英] Using a combined field as id mapping in ElasticSearch
问题描述
从这个问题中,我可以看到使用现有字段作为ID的可能性在Elasticsearch中
From this question I can see that it is possible Use existing field as id in elasticsearch
我的问题是,是否可以做类似的事情,但可以连接字段。
My question is, if can do similar thing but concatenating fields.
{
"RecordID": "a06b0000004SWbdAAG",
"SystemModstamp": "01/31/2013T07:46:02.000Z",
"body": "Test Body"
}
然后执行类似的操作
{
"your_mapping" : {
"_id" : {
"path" : "RecordID" + "body"
}
}
}
因此ID是自动
推荐答案
不,您不能,只能使_id指向位于以下字段内的字段文档,并在需要时也使用点符号(例如 level1,level2.id
)。
No you can't, you can only make the _id point to a field that's within the document, using the dot notation as well if needed (e.g. level1,level2.id
).
建议有一个领域在文档中保留整个id,甚至更好地将id取出并在url中提供,因为配置路径会导致在不需要时对文档进行解析。
I'd suggest to have a field that contains the whole id in your documents, or even better to take the id out and provide it in the url, as configuring a path causes the document to be parsed when not needed.
这篇关于在ElasticSearch中将组合字段用作ID映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!