Transform nodes
Transform nodes allow you to change the output of the document type
rename
¶
We can simply define this JSON schema.
[
{
"database": "book",
"index": "book",
"nodes": {
"table": "book",
"columns": [
"isbn",
"title"
],
"transform": {
"rename": {
"isbn": "book_isbn",
"title": "book_title"
}
}
}
}
]
To get this document structure in Elasticsearch/OpenSearch
[
{
"book_isbn": "9785811243570",
"book_title": "Charlie and the chocolate factory"
},
{
"book_isbn": "9788374950978",
"book_title": "Kafka on the Shore"
},
{
"book_isbn": "9781471331435",
"book_title": "1984"
}
]
mapping
¶
You can specify the data type for an Elasticsearch/OpenSearch field in the schema.
You can find the list of supported data types here
[
{
"database": "book",
"index": "book",
"node": {
"table": "book",
"columns": [
"isbn",
"title"
],
"transform": {
"mapping": {
"id": {
"type": "long"
},
"isbn": {
"type": "long"
},
"title": {
"type": "keyword"
}
}
}
}
}
]
concat
¶
You can concatenate multiple columns into a single field with an optional delimiter.
[
{
"database": "book",
"index": "book",
"node": {
"table": "book",
"columns": [
"title",
"firstname",
"lastname"
],
"transform": {
"concat": {
"columns": ["title", "firstname", "lastname"],
"destination": "fullname",
"delimiter": "-"
}
}
}
}
]