elasticsearch elasticsearch中的数据转换
Elasticsearch 2.0中不推荐使用Transform。在elasticsearch文档中提到,“到目前为止,除了在客户端应用程序中转换文档之外,还没有其他功能可供使用。”请详细说明这句话。它们在客户端应用程序中转换的确切含义是什么
elasticsearch elasticsearch中的数据转换,
elasticsearch,logstash,kibana,
elasticsearch,Logstash,Kibana,Elasticsearch 2.0中不推荐使用Transform。在elasticsearch文档中提到,“到目前为止,除了在客户端应用程序中转换文档之外,还没有其他功能可供使用。”请详细说明这句话。它们在客户端应用程序中转换的确切含义是什么 这是一个链接:这意味着在使用转换脚本在弹性体中编制索引时,不应修改源字段,而应在应用程序中创建最终json并将其发送给弹性体进行索引 不使用此映射: { "example" : { "transform" : {
这是一个链接:这意味着在使用转换脚本在弹性体中编制索引时,不应修改源字段,而应在应用程序中创建最终json并将其发送给弹性体进行索引 不使用此映射:
{
"example" : {
"transform" : {
"script" : {
"inline": "if (ctx._source['title']?.startsWith('t')) ctx._source['suggest'] = ctx._source['content']",
"params" : {
"variable" : "not used but an example anyway"
},
"lang": "groovy"
}
},
"properties": {
"title": { "type": "string" },
"content": { "type": "string" },
"suggest": { "type": "string" }
}
}
}
您只需使用此项:
{
"example" : {
"properties": {
"title": { "type": "string" },
"content": { "type": "string" },
"suggest": { "type": "string" }
}
}
}
并在应用程序中构造JSON,同时强制执行转换规则。在我的示例中,这意味着如果标题以“t”开头,则将json正文的字段“suggest”设置为等于“content”中的值。非常遗憾,他们不赞成这样做。存在仅存在于elasticsearch上的数据,因此不可能在客户端对其进行转换。