如何将(文本)字段添加到 pgsync/elasticsearch 中的所有字段?
How to add (text)fields to all field in pgsync / elasticsearch?
我正在探索pgsync to add elasticsearch support for some tables, however, I would like to be able to copy all the textfields to one "all" field. Elastic has support for this in the form of a mapping to a group field, with copy-to
, see here
像这样:
PUT my-index-000001
{
"mappings": {
"properties": {
"first_name": {
"type": "text",
"copy_to": "full_name"
},
"last_name": {
"type": "text",
"copy_to": "full_name"
},
"full_name": {
"type": "text"
}
}
}
}
如何在 PGSync 中实现这个组字段 schema.json?
您可以在 pgsync 中通过创建具有 mapping
的 transform
节点来执行此操作
类型。
下面是一个示例,说明如何为定义的书籍示例实现此目的 here
[
{
"database": "book",
"index": "book",
"nodes": {
"table": "book",
"columns": [
"id",
"isbn",
"title",
"description"
],
"transform": {
"mapping": {
"title": {
"type": "text",
"copy_to": "full_name"
},
"description": {
"type": "text",
"copy_to": "full_name"
},
"full_name": {
"type": "text"
}
}
}
}
}
]
我正在探索pgsync to add elasticsearch support for some tables, however, I would like to be able to copy all the textfields to one "all" field. Elastic has support for this in the form of a mapping to a group field, with copy-to
, see here
像这样:
PUT my-index-000001
{
"mappings": {
"properties": {
"first_name": {
"type": "text",
"copy_to": "full_name"
},
"last_name": {
"type": "text",
"copy_to": "full_name"
},
"full_name": {
"type": "text"
}
}
}
}
如何在 PGSync 中实现这个组字段 schema.json?
您可以在 pgsync 中通过创建具有 mapping
的 transform
节点来执行此操作
类型。
下面是一个示例,说明如何为定义的书籍示例实现此目的 here
[
{
"database": "book",
"index": "book",
"nodes": {
"table": "book",
"columns": [
"id",
"isbn",
"title",
"description"
],
"transform": {
"mapping": {
"title": {
"type": "text",
"copy_to": "full_name"
},
"description": {
"type": "text",
"copy_to": "full_name"
},
"full_name": {
"type": "text"
}
}
}
}
}
]