Elasticsearch as a destination is deprecated and no longer actively maintained. It remains fully functional and no code is currently being removed. For new mirrors, we recommend ClickHouse, ClickHouse Cloud, or Postgres as the destination.
Prerequisites
To perform CDC from Postgres to Elasticsearch, you first need to create a source and destination Peer.
Create a Source Peer for Postgres. Follow the instructions depending on your Postgres instance:
Once PeerDB is connected to your PostgreSQL database or read replica, we will first do a full initial load of all the selected tables from your database. Then the continuous sync process will start using WAL to capture changes from the source database and apply them to the destination database.By default, PeerDB uses Elasticsearch dynamic mapping to map Postgres source types to Elasticsearch types. For reference, please refer to the Data Type Mapping page. In case a stricter mapping is required, you can use the Elasticsearch Mapping API to define the mapping for your index before creating the mirror.
1
Create Mirror Screen
Click on Mirrors tab and then enter new Mirror screen
2
Mirror Type
Since in this walkthrough we are focussing on CDC based replication, choose CDC as the mirror type.
3
Mirror Name
Enter a unique identifier for the mirror name. This is used to uniquely identify the mirror in the PeerDB UI. Make this alphanumeric and without any special characters except underscores.
4
Select Source and Destination Peers
Select the source and destination peers that you created in the prerequisites in the drop down.
source and destination drop down
5
Mirror Configuration
Initial Snapshot: Selecting this option will do a full initial load of all the selected tables from your database. This is useful when you are setting up the mirror for the first time. Default is enabled.
Sync Interval (Seconds): This is the interval at which PeerDB will flush the record batch and then restart polling the source database for changes. Default is 60 seconds.
Publication Name: This is the name of the publication that you created in the source database. This is used to capture changes from the source database. If you have not created a publication, you can leave this blank and PeerDB will create a publication for you. If you have already created a publication dedicated to PeerDB, don’t forget adding that in this field.
Replication Slot Name: This is the name of the replication slot that you created in the source database. This is used to capture changes from the source database. If you have not created a replication slot, you can leave this blank and PeerDB will create a replication slot for you. Do note that initial snapshot is only supported if PeerDB is able to create a slot.
Snapshot Number of Rows Per Partition: This is the number of rows that will be fetched in each partition during the initial snapshot. Default is 500000. This is useful when you have a large number of rows in your tables and you want to control the number of rows fetched in each partition.
Snapshot Maximum Parallel Workers: This is the number of parallel workers that will be used to fetch the initial snapshot. Default is 1. This is useful when you have a large number of tables and you want to control the number of parallel workers used to fetch the initial snapshot. This setting is per-table.
Snapshot Number of Tables In Parallel: This is the number of tables that will be fetched in parallel during the initial snapshot. Default is 4. This is useful when you have a large number of tables and you want to control the number of tables fetched in parallel.
Soft Delete: This is set to true by default. Elasticsearch does not support soft delete currently, so this should be set to false.
6
Table Selection
Select the tables that you want to replicate from the source database to the destination database. You can use the search bar to search for the tables. You can also use the filter to filter the tables based on the schema.
Table Selection
7
Review and Create
Review the mirror configuration and click on the Validate Mirror button. If there are any errors, you will see them on the screen. If there are no errors, you will see a success message. Once you see the success message, click on the Create Mirror button to create the mirror ✨.
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"PeerDB Docs: Setup your ETL in minutes with SQL.","colors":{"primary":"#248736","light":"#248736","dark":"#248736"},"favicon":"https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/favicon.png?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=bcb6625d7fc622364e8380f49bc07790","logo":{"light":"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=90ac5de385106617a465b7ba4d33a28e","dark":"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-dark.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=feffd926023e0bcf9c5d4282d426fe12"},"navbar":{"primary":{"type":"button","label":"Get Started","href":"https://app.peerdb.cloud"}},"footer":{"socials":{"github":"https://github.com/PeerDB-io"}},"integrations":{"ga4":{"measurementId":"G-1V9ZZCZMB7"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"peerdb","hasAudioNarration":false,"actualSubdomain":"peerdb","customDomains":["docs.peerdb.io"],"gitSource":{"type":"github","owner":"peerdb-io","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aed019de03b16c7c232c60e","clientVersion":"0.0.4131","searchFilterCounts":[{"language":"default","tag":"Documentation","count":75},{"language":"default","tag":"Setup","count":17},{"language":"default","tag":"API Reference","count":14},{"language":"default","tag":"API Endpoints","count":14},{"language":"default","tag":"Use-cases","count":12},{"language":"default","tag":"SQL Reference","count":10},{"language":"default","tag":"SQL Commands","count":10},{"language":"default","tag":"PostgreSQL Setup Guide","count":9},{"language":"default","tag":"Features","count":9},{"language":"default","tag":"Mirror","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"mirror/cdc-pg-elasticsearch","slug":"/mirror/cdc-pg-elasticsearch","pageMetadata":{"title":"CDC Setup from Postgres to Elasticsearch","description":null,"href":"/mirror/cdc-pg-elasticsearch"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Frame,Heading,OptimizedFrame,OptimizedImage,Step,Steps,Warning}=_components;if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedFrame)_missingMdxReference(`OptimizedFrame`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsx(_components.p,{children:`Elasticsearch as a destination is deprecated and no longer actively maintained. It remains fully functional and no code is currently being removed. For new mirrors, we recommend ClickHouse, ClickHouse Cloud, or Postgres as the destination.`})}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsx(_components.p,{children:`To perform CDC from Postgres to Elasticsearch, you first need to create a source and destination Peer.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Create a Source Peer for Postgres. Follow the instructions depending on your Postgres instance:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/connect/postgres/rds_postgres`,children:`RDS`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/connect/postgres/cloudsql_postgres`,children:`Cloud SQL`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/connect/postgres/azure_flexible_server_postgres`,children:`Azure Flexible Server`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/connect/postgres/crunchy_bridge`,children:`Crunchy Bridge`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Create a Destination Peer for Elasticsearch`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/connect/elasticsearch`,children:`Elasticsearch`})}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`demo`,children:`Demo`}),`\n`,_jsx(`div`,{style:{position:`relative`,paddingBottom:`55.5%`,height:0},children:_jsx(OptimizedFrame,{src:`https://www.loom.com/embed/59af80e870dc4b6791e95e4a136ea8e1?sid=d5e9068f-1e6d-4b03-b688-49f4171ad057`,allowFullScreen:true,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,border:`none`}})}),`\n`,_jsx(Heading,{level:`2`,id:`mirror-overview`,children:`Mirror Overview`}),`\n`,_jsx(_components.p,{children:`Once PeerDB is connected to your PostgreSQL database or read replica, we will first do a full initial load of all the selected tables from your database. Then the continuous sync process will start using WAL to capture changes from the source database and apply them to the destination database.`}),`\n`,_jsxs(_components.p,{children:[`By default, PeerDB uses Elasticsearch `,_jsx(_components.a,{href:`https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic-field-mapping.html`,children:`dynamic mapping`}),` to map Postgres source types to Elasticsearch types. For reference, please refer to the `,_jsx(_components.a,{href:`/datatypes/datatype-matrix`,children:`Data Type Mapping`}),` page. In case a stricter mapping is required, you can use the `,_jsx(_components.a,{href:`https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html`,children:`Elasticsearch Mapping API`}),` to define the mapping for your index before creating the mirror.`]}),`\n`,_jsxs(Steps,{children:[_jsx(Step,{title:`Create Mirror Screen`,children:_jsx(Frame,{caption:`Click on Mirrors tab and then enter new Mirror screen`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=71bd733918b0ed8ddea5e0e3be42a32a`,\"data-og-width\":`3456`,width:`3456`,\"data-og-height\":`1916`,height:`1916`,\"data-path\":`images/cdc/new-mirror-1.jpeg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?w=280\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=d3f29cfb2b62a420789ae74ab7207889 280w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?w=560\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=d3027258fc33e5b32dbb588b0369041c 560w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?w=840\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=17feac25bf58cf724e3c24dbb5a70bd1 840w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?w=1100\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=ef9e21910c8cbada09e7841a063facb5 1100w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?w=1650\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=9c1580a6d9cb0f5ba358e30ec95ace63 1650w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/new-mirror-1.jpeg?w=2500\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=0679433024e57f21afd9f7f816b70c51 2500w`})})}),_jsx(Step,{title:`Mirror Type`,children:_jsx(_components.p,{children:`Since in this walkthrough we are focussing on CDC based replication, choose CDC as the mirror type.`})}),_jsx(Step,{title:`Mirror Name`,children:_jsx(_components.p,{children:`Enter a unique identifier for the mirror name. This is used to uniquely identify the mirror in the PeerDB UI. Make this alphanumeric and without any special characters except underscores.`})}),_jsxs(Step,{title:`Select Source and Destination Peers`,children:[_jsx(_components.p,{children:`Select the source and destination peers that you created in the prerequisites in the drop down.`}),_jsx(Frame,{caption:`source and destination drop down`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=46b10d808f4fb780e4626400b10cc303`,\"data-og-width\":`1104`,width:`1104`,\"data-og-height\":`240`,height:`240`,\"data-path\":`images/cdc/pg-es-dropdown.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?w=280\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=e30a9cf429ebff8bccd6289b9dd3cbb6 280w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?w=560\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=fbfc8c90e3753aa9c875d4a5c7bf458d 560w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?w=840\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=c9a06ce99950e5ed7d84bdac05af86c6 840w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?w=1100\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=18cd1210049cb7a3ca192b5bc42ce907 1100w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?w=1650\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=be7c05f0baf4871f510d76af9cbe9a03 1650w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/pg-es-dropdown.png?w=2500\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=09bc56d280f01ad26408e1f8ab3debd6 2500w`})})]}),_jsx(Step,{title:`Mirror Configuration`,children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Initial Snapshot`}),`: Selecting this option will do a full initial load of all the selected tables from your database. This is useful when you are setting up the mirror for the first time. Default is enabled.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Sync Interval (Seconds)`}),`: This is the interval at which PeerDB will flush the record batch and then restart polling the source database for changes. Default is `,_jsx(_components.code,{children:`60`}),` seconds.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Publication Name`}),`: This is the name of the publication that you created in the source database. This is used to capture changes from the source database. If you have not created a publication, you can leave this blank and PeerDB will create a publication for you. If you have already created a publication dedicated to PeerDB, don’t forget adding that in this field.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Replication Slot Name`}),`: This is the name of the replication slot that you created in the source database. This is used to capture changes from the source database. If you have not created a replication slot, you can leave this blank and PeerDB will create a replication slot for you. Do note that initial snapshot is only supported if PeerDB is able to create a slot.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Snapshot Number of Rows Per Partition`}),`: This is the number of rows that will be fetched in each partition during the initial snapshot. Default is `,_jsx(_components.code,{children:`500000`}),`. This is useful when you have a large number of rows in your tables and you want to control the number of rows fetched in each partition.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Snapshot Maximum Parallel Workers`}),`: This is the number of parallel workers that will be used to fetch the initial snapshot. Default is `,_jsx(_components.code,{children:`1`}),`. This is useful when you have a large number of tables and you want to control the number of parallel workers used to fetch the initial snapshot. This setting is per-table.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Snapshot Number of Tables In Parallel`}),`: This is the number of tables that will be fetched in parallel during the initial snapshot. Default is `,_jsx(_components.code,{children:`4`}),`. This is useful when you have a large number of tables and you want to control the number of tables fetched in parallel.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Soft Delete`}),`: This is set to `,_jsx(_components.code,{children:`true`}),` by default. Elasticsearch does not support soft delete currently, so this should be set to false.`]}),`\n`]})}),_jsxs(Step,{title:`Table Selection`,children:[_jsx(_components.p,{children:`Select the tables that you want to replicate from the source database to the destination database. You can use the search bar to search for the tables. You can also use the filter to filter the tables based on the schema.`}),_jsx(Frame,{caption:`Table Selection`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=5013798352946fd36dc5770b764bfa5a`,\"data-og-width\":`1762`,width:`1762`,\"data-og-height\":`1322`,height:`1322`,\"data-path\":`images/cdc/mirror-drop-down.jpeg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?w=280\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=0b4d4b20939610da71a980ff9480a090 280w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?w=560\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=656ef23757acd91feb8530aecf0e3dde 560w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?w=840\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=2f552ca7a1beef6f3746b0a1028b4b93 840w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?w=1100\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=7dfee84b6499ff4911e1ff621c279404 1100w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?w=1650\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=d6e0f3fd6def7a6b23bf7ca8f412dbc8 1650w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/cdc/mirror-drop-down.jpeg?w=2500\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=77b2453076c7d847c92c48218dc4db9c 2500w`})})]}),_jsx(Step,{title:`Review and Create`,children:_jsxs(_components.p,{children:[`Review the mirror configuration and click on the `,_jsx(_components.code,{children:`Validate Mirror`}),` button. If there are any errors, you will see them on the screen. If there are no errors, you will see a success message. Once you see the success message, click on the `,_jsx(_components.code,{children:`Create Mirror`}),` button to create the mirror ✨.`]})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"CDC Setup from Postgres to Elasticsearch","description":null,"href":"/mirror/cdc-pg-elasticsearch"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"Demo","slug":"demo","depth":2,"children":[]},{"title":"Mirror Overview","slug":"mirror-overview","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"peerdb","siteName":"PeerDB Docs: Setup your ETL in minutes with SQL.","title":"CDC Setup from Postgres to Elasticsearch - PeerDB Docs: Setup your ETL in minutes with SQL.","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-21T18:07:55.694Z","originalFileLocation":"mirror/cdc-pg-elasticsearch.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"CDC Setup from Postgres to Elasticsearch - PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://peerdb.mintlify.site/_mintlify/api/og/v2?division=Mirror\u0026amp;title=CDC+Setup+from+Postgres+to+Elasticsearch\u0026amp;theme=0c9020805cc6aa769a2dba47\u0026amp;signature=ef3f07fd408c9180e5bcf7476b96db203b0d9a17b25e766d98312740cec14c09\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"CDC Setup from Postgres to Elasticsearch - PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://peerdb.mintlify.site/_mintlify/api/og/v2?division=Mirror\u0026amp;title=CDC+Setup+from+Postgres+to+Elasticsearch\u0026amp;theme=0c9020805cc6aa769a2dba47\u0026amp;signature=ef3f07fd408c9180e5bcf7476b96db203b0d9a17b25e766d98312740cec14c09\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#248736\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/mirror/cdc-pg-elasticsearch.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.peerdb.io/#organization\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"url\":\"https://docs.peerdb.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=90ac5de385106617a465b7ba4d33a28e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.peerdb.io#website\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"url\":\"https://docs.peerdb.io\",\"publisher\":{\"@id\":\"https://docs.peerdb.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch#webpage\",\"url\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch\",\"name\":\"CDC Setup from Postgres to Elasticsearch\",\"dateModified\":\"2026-08-21T18:07:55.694Z\",\"isPartOf\":{\"@id\":\"https://docs.peerdb.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Mirror\",\"item\":\"https://docs.peerdb.io/mirror/cdc-pg-clickhouse\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CDC Setup from Postgres to Elasticsearch\",\"item\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch#article\",\"headline\":\"CDC Setup from Postgres to Elasticsearch\",\"name\":\"CDC Setup from Postgres to Elasticsearch\",\"url\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch\",\"mainEntityOfPage\":{\"@id\":\"https://docs.peerdb.io/mirror/cdc-pg-elasticsearch#webpage\"},\"dateModified\":\"2026-08-21T18:07:55.694Z\",\"publisher\":{\"@id\":\"https://docs.peerdb.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.peerdb.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/mirror/cdc-pg-elasticsearch.md","siteName":"PeerDB Docs: Setup your ETL in minutes with SQL.","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Home","pages":[{"title":"PeerDB","href":"/introduction"},{"title":"Architecture Overview","href":"/architecture"},{"title":"Why choose PeerDB over other tools?","href":"/why-peerdb"}]},{"group":"Quickstart","pages":[{"title":"Quickstart Guide","href":"/quickstart/quickstart"},{"title":"PeerDB Streams for Kafka Quickstart Guide","href":"/quickstart/streams-quickstart"},{"title":"SQL Quickstart Guide","href":"/quickstart/sql-quickstart"}]},{"group":"PeerDB Cloud","pages":[{"title":"PeerDB Cloud Quickstart Guide","icon":"rocket","iconType":"solid","href":"/peerdb-cloud/cloud-quickstart"},{"title":"PeerDB Cloud Security","icon":"lock","iconType":"solid","href":"/peerdb-cloud/cloud-security"},{"title":"PeerDB Cloud Pricing FAQ","icon":"question","iconType":"solid","href":"/peerdb-cloud/peerdb-cloud-pricing-faq"},{"title":"Trust Center","url":"https://trust.peerdb.io/","icon":"shield-halved","iconType":"solid","href":"/peerdb-cloud/cloud-trust-center"},{"title":"Public IPs For PeerDB Cloud","icon":"server","iconType":"regular","href":"/peerdb-cloud/ip-table"},{"title":"AWS Private Link","icon":"diagram-project","iconType":"solid","href":"/peerdb-cloud/aws-private-link"}]},{"group":"Setup","pages":[{"group":"PostgreSQL Setup Guide","pages":[{"title":"RDS Postgres Source Setup Guide","href":"/connect/postgres/rds_postgres"},{"title":"Supabase Postgres Source Setup Guide on PeerDB Cloud","href":"/connect/postgres/supabase_postgres_peerdb_cloud"},{"title":"Supabase Postgres Source Setup Guide","href":"/connect/postgres/supabase_postgres"},{"title":"Google CloudSQL Postgres Source Setup Guide","href":"/connect/postgres/cloudsql_postgres"},{"title":"Azure Flexible Server Postgres Source Setup Guide","href":"/connect/postgres/azure_flexible_server_postgres"},{"title":"Crunchy Bridge Postgres Source Setup Guide","href":"/connect/postgres/crunchy_bridge"},{"title":"Neon Postgres Source Setup Guide","href":"/connect/postgres/neon_postgres"},{"title":"Generic PostgreSQL Source Setup Guide","href":"/connect/postgres/generic_postgres"},{"title":"Unsupported PostgreSQL Providers","href":"/connect/postgres/unsupported_providers"}]},{"title":"CockroachDB Source Setup Guide","href":"/connect/cockroachdb"},{"group":"Clickhouse Setup Guide","pages":[{"title":"ClickHouse Cloud Setup Guide","href":"/connect/clickhouse/clickhouse-cloud"},{"title":"ClickHouse Setup Guide","href":"/connect/clickhouse/clickhouse"}]},{"title":"Snowflake Setup Guide","href":"/connect/snowflake"},{"title":"BigQuery Setup Guide","href":"/connect/bigquery"},{"title":"GCS Setup Guide","href":"/connect/gcs"},{"title":"S3 Setup Guide","href":"/connect/s3"},{"title":"Elasticsearch Setup Guide","href":"/connect/elasticsearch"}]},{"group":"Queues Setup","pages":[{"title":"Kafka Setup Guide","href":"/connect/kafka"},{"title":"Confluent Cloud Setup Guide","href":"/connect/confluent-cloud"},{"title":"PubSub Setup Guide","href":"/connect/pubsub"}]},{"group":"Mirror","pages":[{"title":"CDC Setup from Postgres to ClickHouse","href":"/mirror/cdc-pg-clickhouse"},{"title":"CDC Setup from Supabase to ClickHouse","href":"/mirror/cdc-supabase-clickhouse"},{"title":"CDC Setup from Neon Postgres to ClickHouse","href":"/mirror/cdc-neon-clickhouse"},{"title":"CDC Setup from Postgres to Bigquery","href":"/mirror/cdc-pg-bq"},{"title":"CDC Setup from Postgres to Snowflake","href":"/mirror/cdc-pg-sf"},{"title":"CDC Setup from Postgres to Postgres","href":"/mirror/cdc-pg-pg"},{"title":"CDC Setup from Postgres to Kafka","description":null,"href":"/mirror/cdc-pg-kafka"},{"title":"CDC Setup from Postgres to Elasticsearch","href":"/mirror/cdc-pg-elasticsearch"},{"title":null,"description":null,"href":"/mirror/upgrade"}]},{"group":"5-minute Tutorials","pages":[{"title":"Streaming Query Replication of PostgreSQL To Snowflake","href":"/tutorials/realtime-streaming-of-query-results"}]},{"group":"Features","pages":[{"title":"Pausing a CDC Mirror","href":"/features/pause-mirror"},{"title":"Editing a CDC Mirror","href":"/features/edit-mirror"},{"title":"Resyncing a CDC Mirror","href":"/features/resync-mirror"},{"title":"Schema Changes Propagation Support","href":"/features/schema-changes"},{"title":null,"href":"/features/replicating-partitioned-tables"},{"title":null,"href":"/features/feature-matrix"},{"title":null,"href":"/features/supported-connectors"},{"group":"Alerting","pages":[{"title":"Slack Alerting","href":"/features/alerting/slack-alerting"},{"title":"Email Alerting","href":"/features/alerting/email-alerting"}]}]},{"group":"Data types","pages":[{"title":null,"href":"/datatypes/datatype-matrix"}]},{"group":"Best practices","pages":[{"title":"Postgres to ClickHouse: Data Modeling Tips","href":"/bestpractices/clickhouse_datamodeling"},{"title":"Heartbeat Table For CDC","href":"/bestpractices/heartbeat"},{"title":"Upgrading the PostgreSQL Peer Of An Ongoing CDC Mirror","href":"/bestpractices/postgres-upgrade"},{"title":"Generated Columns: Gotchas and Best Practices","href":"/bestpractices/generated_columns"},{"title":"Postgres to ClickHouse: Handling TOAST Columns","href":"/bestpractices/clickhouse_toast_columns"},{"title":"Defining the Ordering Key in ClickHouse differently from the Primary Key in Postgres","href":"/bestpractices/ordering-key-different"}]},{"group":"Use-cases","pages":[{"group":"Real-time Change Data Capture from Postgres","pages":[{"title":"Overview","href":"/usecases/real-time-cdc/overview"},{"title":"PostgreSQL To PostgreSQL","href":"/usecases/real-time-cdc/postgres-to-postgres"},{"title":"PostgreSQL to BigQuery","href":"/usecases/real-time-cdc/postgres-to-bigquery"},{"title":"PostgreSQL To Snowflake","href":"/usecases/real-time-cdc/postgres-to-snowflake"},{"title":"PostgreSQL To Azure Event Hubs","href":"/usecases/real-time-cdc/postgres-to-azure-eventhubs"},{"title":"PostgreSQL To AWS S3 And Google Cloud Storage","href":"/usecases/real-time-cdc/postgres-to-cloud"}]},{"group":"Streaming Query Replication","pages":[{"title":"Overview","href":"/usecases/streaming-query-replication/overview"},{"title":"PostgreSQL to PostgreSQL","href":"/usecases/streaming-query-replication/postgres-to-postgres"},{"title":"PostgreSQL to BigQuery","href":"/usecases/streaming-query-replication/postgres-to-bigquery"},{"title":"PostgreSQL to S3","href":"/usecases/streaming-query-replication/postgres-to-s3"},{"title":"PostgreSQL to Snowflake","href":"/usecases/streaming-query-replication/postgres-to-snowflake"}]},{"title":"Query Federation via PostgreSQL","href":"/usecases/postgres-compatible-layer-for-bigquery-and-snowflake"}]},{"group":"Benchmarks","pages":[{"title":null,"href":"/benchmarks/benchmarking-Postgres-Replication:-PeerDB-vs-Airbyte"}]},{"group":"Contributing","pages":[{"title":"Running Flow tests","href":"/dev/running-tests"}]},{"group":"Metrics and Tuning","pages":[{"title":"Config Tuning for Change Data Capture (CDC)","href":"/metrics/important_cdc_configs"},{"title":"Native Metrics","href":"/metrics/native-metrics"}]},{"group":"FAQs","pages":[{"title":"Frequently Asked Questions","href":"/faqs/faqs"}]}]},{"anchor":"SQL Reference","icon":"rectangle-terminal","pages":[{"title":"SQL Reference","href":"/sql/reference"}]},{"anchor":"API Reference","icon":"browser","pages":[{"title":"API Reference","href":"/peerdb-api/reference"}]},{"anchor":"Lua Reference","icon":"file-code","pages":[{"title":"Lua Reference","href":"/lua/reference"}]},{"anchor":"GitHub","href":"https://github.com/PeerDB-io/peerdb","icon":"github"},{"anchor":"Changelog","href":"https://github.com/PeerDB-io/peerdb/releases","icon":"list"},{"anchor":"Community","href":"https://slack.peerdb.io","icon":"slack"}]},"basePath":"","title":"CDC Setup from Postgres to Elasticsearch - PeerDB Docs: Setup your ETL in minutes with SQL.","buildId":"dpl_5joLUXmnJgwqjrHAS4dxZrQTdxgh","deploymentId":"dpl_5joLUXmnJgwqjrHAS4dxZrQTdxgh","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-B_503rGq.js","DynamicMarkdown-BfddVCX7.js","zoom-image-lightbox-B3yYlvdS.js","lightbox-handle-r17bVUz3.js"]}