{"id":8573,"date":"2019-12-20T10:02:31","date_gmt":"2019-12-20T10:02:31","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=8573"},"modified":"2025-03-19T08:34:07","modified_gmt":"2025-03-19T08:34:07","slug":"read-data-from-elasticsearch-using-ssis","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/","title":{"rendered":"How to read data from ElasticSearch using SSIS"},"content":{"rendered":"<h2>Introduction<\/h2>\n<div class=\"su-note\"  style=\"border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><strong>UPDATE:<\/strong>\u00a0ZappySys has released a brand new <a href=\"https:\/\/zappysys.com\/api\/integration-hub\/elasticsearch-connector\/\">API Connector for ElasticSearch<\/a> which makes it much simpler to\u00a0<strong>Read\/Write ElasticSearch Data in SSIS<\/strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid a learning curve with API then use a newer approach.<\/p>\n<p>Please visit <a href=\"https:\/\/zappysys.com\/api\/integration-hub\/\">this page to see all<\/a>\u00a0preconfigured ready-to-use API connectors that you can use in <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-api-source\/\">SSIS API Source<\/a> \/ <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-api-destination\/\">SSIS API Destination<\/a> OR\u00a0<a href=\"https:\/\/zappysys.com\/products\/odbc-powerpack\/odbc-api-driver\/\">API ODBC Driver<\/a> (for non-SSIS Apps such as Excel, Power BI, and Informatica).<\/p>\n<\/div><\/div>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-1406 size-thumbnail\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180-150x150.png\" alt=\"\" width=\"150\" height=\"150\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180-150x150.png 150w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png 180w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/p>\n<p>In our previous article, we see\u00a0how to\u00a0<a href=\"https:\/\/zappysys.com\/blog\/load-data-from-sql-server-to-elasticsearch-using-ssis\/\" target=\"_blank\" rel=\"noopener\">load data into Elastic Search using SSIS<\/a>. Now let&#8217;s look at <strong>how to read data from ElasticSearch using SSIS<\/strong>\u00a0and load response into SQL Server.<\/p>\n<p><a href=\"https:\/\/www.elastic.co\/\" target=\"_blank\" rel=\"noopener\">Elasticsearch<\/a>\u00a0is a powerful engine that allows you to store, aggregate, and, most importantly, search data in a very analytical way. In this tutorial, you will learn how to load <em>Elasticsearch\u00a0<\/em>data to\u00a0<em>SQL Server <\/em>with\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/integration-services\/sql-server-integration-services\" target=\"_blank\" rel=\"noopener\"><acronym title=\"SQL Server Integration Services\">SSIS<\/acronym><\/a>\u00a0(part of SQL Server) and <a href=\"\/\/zappysys.com\/products\/ssis-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys PowerPack<\/a>. We also see how to set the maximum result window of the index using the Rest API Task.<\/p>\n<p>In a nutshell,\u00a0this post will focus on how to Make Elasticsearch Search API call using SSIS.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"content_block\" id=\"custom_post_widget-2523\"><h2><span id=\"Prerequisites\">Prerequisites<\/span><\/h2>\r\nBefore we perform the steps listed in this article, you will need to make sure the following prerequisites are met:\r\n<ol style=\"margin-left: 1.5em;\">\r\n \t<li><abbr title=\"SQL Server Integration Services\">SSIS<\/abbr> designer installed.\u00a0Sometimes it is referred to as <abbr title=\"Business Intelligence Development Studio\">BIDS<\/abbr> or <abbr title=\"SQL Server Data Tools\">SSDT<\/abbr> (<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssdt\/download-sql-server-data-tools-ssdt\" target=\"_blank\" rel=\"noopener\">download it from the Microsoft site<\/a>).<\/li>\r\n \t<li>Basic knowledge of SSIS package\u00a0development using\u00a0<em>Microsoft SQL Server Integration Services<\/em>.<\/li>\r\n \t<li>Make sure\u00a0<span style=\"text-decoration: underline;\"><a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys SSIS PowerPack<\/a><\/span>\u00a0is installed (<a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/download\/\" target=\"_blank\" rel=\"noopener\">download it<\/a>, if you haven't already).<\/li>\r\n \t<li>(<em>Optional step<\/em>)<em>.<\/em>\u00a0<a href=\"https:\/\/zappysys.zendesk.com\/hc\/en-us\/articles\/360035974593\" target=\"_blank\" rel=\"noopener\">Read this article<\/a>, if you are planning to deploy packages to a server and schedule their execution later.<\/li>\r\n<\/ol><\/div>\n<h2><span id=\"CallUPSREST_API_using_SSIS\">Step-By-Step to Call Elasticsearch API call<span id=\"Step-By-Step_8211_CallSemantics3_REST_API_using_SSIS\">\u00a0using SSIS<\/span><\/span><\/h2>\n<h3>Read from Elasticsearch Search API call<\/h3>\n<p>Let&#8217;s make the\u00a0Elasticsearch <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/search.html\" target=\"_blank\" rel=\"noopener\">Search API<\/a> call using the JSON source to get all the records of the index with pagination.<\/p>\n<ol>\n<li>First\u00a0of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.\n<div id=\"attachment_8028\" style=\"width: 470px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/02\/drag-and-drop-data-flow-task.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8028\" class=\"wp-image-8028 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/02\/drag-and-drop-data-flow-task.png\" alt=\"\" width=\"460\" height=\"155\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/02\/drag-and-drop-data-flow-task.png 460w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/02\/drag-and-drop-data-flow-task-300x101.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/a><p id=\"caption-attachment-8028\" class=\"wp-caption-text\">Dragging and dropping Data Flow Task into Control Flow<\/p><\/div><\/li>\n<li>From the SSIS toolbox drag and drop JSON Source on the data flow designer surface.\n<div id=\"attachment_3766\" style=\"width: 604px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/05\/ssis-json-source-for-getting-basic-profile-from-linkedin.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-3766\" class=\"wp-image-3766 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/05\/ssis-json-source-for-getting-basic-profile-from-linkedin.png\" alt=\"Drag and Drop JSON Source Component\" width=\"594\" height=\"268\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/05\/ssis-json-source-for-getting-basic-profile-from-linkedin.png 594w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/05\/ssis-json-source-for-getting-basic-profile-from-linkedin-300x135.png 300w\" sizes=\"(max-width: 594px) 100vw, 594px\" \/><\/a><p id=\"caption-attachment-3766\" class=\"wp-caption-text\">Drag and Drop JSON Source Component<\/p><\/div><\/li>\n<li>Double click JSON Source and enter the following URL as below to make\u00a0Search API Call on the index.\n<pre class=\"lang:default decode:true\">http:\/\/{elasticsearch-site-url}\/{index}\/{index-type}\/_search<\/pre>\n<\/li>\n<li>Now check Use credentials and\u00a0<em>Select Connection<\/em> section press <span class=\"lang:default highlight:0 decode:true crayon-inline\">&lt;New ZS-HTTP Connection&gt;<\/span>.\n<div id=\"attachment_1676\" style=\"width: 972px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2015\/08\/ssis-json-source-rest-api-http-basic-authentication-pass-userid-password.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1676\" class=\"size-full wp-image-1676\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2015\/08\/ssis-json-source-rest-api-http-basic-authentication-pass-userid-password.png\" alt=\"SSIS JSON Source - Passing Basic Credentials (Supply UserID \/ Password) using HTTP Connection\" width=\"962\" height=\"757\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2015\/08\/ssis-json-source-rest-api-http-basic-authentication-pass-userid-password.png 962w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2015\/08\/ssis-json-source-rest-api-http-basic-authentication-pass-userid-password-300x236.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2015\/08\/ssis-json-source-rest-api-http-basic-authentication-pass-userid-password-768x604.png 768w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/a><p id=\"caption-attachment-1676\" class=\"wp-caption-text\">SSIS JSON Source &#8211; Passing Basic Credentials (Supply UserID \/ Password) using HTTP Connection<\/p><\/div><\/li>\n<li>Once the\u00a0<em>HTTP Connection Manager<\/em> window opens configure the connection to your Elasticsearch instance:\n<ul>\n<li>Set <em>Web Url<\/em>, which points to your Elasticsearch instance.<\/li>\n<li>Set <em>Credentials Type<\/em> to <span class=\"lang:default decode:true crayon-inline\">Basic &#8211; UserID\/Password<\/span>\u00a0(or other appropriate authentication methods).<\/li>\n<li>Finally, set <em>User Name<\/em> and <em>Password:<br \/>\n<\/em><\/p>\n<div id=\"attachment_1419\" style=\"width: 330px\" class=\"wp-caption alignnone\"><a href=\"\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/ssis-post-data-to-elasticsearch-configure-http-connection.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1419\" class=\"wp-image-1419 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/ssis-post-data-to-elasticsearch-configure-http-connection.png\" alt=\"Configure SSIS HTTP Connection to connect to Elasticsearch\" width=\"320\" height=\"207\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/ssis-post-data-to-elasticsearch-configure-http-connection.png 320w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/ssis-post-data-to-elasticsearch-configure-http-connection-300x194.png 300w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/a><p id=\"caption-attachment-1419\" class=\"wp-caption-text\">Configure SSIS <em>HTTP Connection<\/em> to connect to Elasticsearch<\/p><\/div><\/li>\n<\/ul>\n<\/li>\n<li>Now, select method as POST and set for and size value in the body to get data using pagination.\u00a0Set the content type as JSON (application\/json).\n<pre class=\"lang:default decode:true\">{\"from\" : &lt;%page%&gt;, \"size\" : 100}<\/pre>\n<\/li>\n<li>Furthermore, go to the pagination tab and configure pagination like the below screenshot makes sure we need to enter increment size the same as given in body size value therefor 100.\n<div id=\"attachment_8600\" style=\"width: 747px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-pagination-post-data-mode.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8600\" class=\"size-full wp-image-8600\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-pagination-post-data-mode.png\" alt=\"Pagination Mode : POST data in body\" width=\"737\" height=\"720\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-pagination-post-data-mode.png 737w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-pagination-post-data-mode-300x293.png 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><p id=\"caption-attachment-8600\" class=\"wp-caption-text\">Pagination Mode: POST data in the body<\/p><\/div><\/li>\n<li>That&#8217;s it now select the desired filter and click on the Preview button.<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-preview-elasticsearch-api.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium_large wp-image-8597\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-preview-elasticsearch-api-768x657.png\" alt=\"\" width=\"720\" height=\"616\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-preview-elasticsearch-api-768x657.png 768w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-preview-elasticsearch-api-300x257.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-json-source-preview-elasticsearch-api.png 917w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/li>\n<li>That&#8217;s it we are ready to load the data in the SQL Server.<\/li>\n<\/ol>\n<h3>For more than 10000 rows<\/h3>\n<p>When you try to get more than 100000 rows you will get the next error message<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"error\": {\r\n        \"root_cause\": [\r\n            {\r\n                \"type\": \"illegal_argument_exception\",\r\n                \"reason\": \"Result window is too large, from + size must be less than or equal to: [10000] but was [11000]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.\"\r\n            }\r\n        ]\r\n    },\r\n    \"status\": 400\r\n}\r\n<\/pre>\n<p>Here is how to configure your JSON Source to pull more than 10K rows using Scroll Method.<\/p>\n<ol>\n<li>In Settings Tab: In the Body and URL rather than Index name use <span class=\"lang:default decode:true crayon-inline\">[$tag$]<\/span><\/li>\n<li>In the filter type: <span class=\"lang:default decode:true crayon-inline\">$.hits.hits[*]._source<\/span><\/li>\n<li>Uncheck Include Parent\n<div id=\"attachment_10804\" style=\"width: 838px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/JSON-source-tag.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10804\" class=\"size-full wp-image-10804\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/JSON-source-tag.png\" alt=\"Elasticsearch JSON source general tab\" width=\"828\" height=\"808\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/JSON-source-tag.png 828w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/JSON-source-tag-300x293.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/JSON-source-tag-768x749.png 768w\" sizes=\"(max-width: 828px) 100vw, 828px\" \/><\/a><p id=\"caption-attachment-10804\" class=\"wp-caption-text\">Elasticsearch example for more than 10000 rows<\/p><\/div><\/li>\n<li>In\u00a0Pagination Tab,\u00a0Set Next Link as below <span class=\"lang:default decode:true crayon-inline \">$._scroll_id<\/span><\/li>\n<li>Stop Indicator Attribute as below <span class=\"lang:default decode:true crayon-inline \">$.hits.hits[0]._id<\/span><\/li>\n<li>Stop Indicator Value as <span class=\"lang:default decode:true crayon-inline\">regex=^$ <\/span>\n<div id=\"attachment_10805\" style=\"width: 676px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-pagination-tab.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10805\" class=\"size-full wp-image-10805\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-pagination-tab.png\" alt=\"Elasticsearch JSON source pagination tab\" width=\"666\" height=\"299\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-pagination-tab.png 666w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-pagination-tab-300x135.png 300w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/a><p id=\"caption-attachment-10805\" class=\"wp-caption-text\">Elasticsearch pagination tab configuration<\/p><\/div><\/li>\n<li>In\u00a0Advanced Pagination Tab,\u00a0Check Has Different Page Info and\u00a0Enable Page Token<\/li>\n<li>Enter Page Place Holders as below (change YOUR_INDEX_NAME)<br \/>\n<span class=\"lang:default decode:true crayon-inline \">url=YOUR_INDEX_NAME\/_search?scroll=10m|_search\/scroll<\/span><\/li>\n<li>First Page Body as below &#8211; Change query as needed else keep it match all to fetch all rows from Index<br \/>\n<span class=\"lang:default decode:true crayon-inline \">{ &#8220;size&#8221;:1000, &#8220;query&#8221;: { &#8220;match_all&#8221;: { }\u00a0 } }<\/span><\/li>\n<li>Next Page Body as below\u00a0<span class=\"lang:default decode:true crayon-inline\">{\u00a0 &#8220;scroll&#8221;: &#8220;5m&#8221;, &#8220;scroll_id&#8221;: &#8220;[$pagetoken$]&#8221; }<\/span>\n<div id=\"attachment_10806\" style=\"width: 676px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-advanced-pagination-tab.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-10806\" class=\"size-full wp-image-10806\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-advanced-pagination-tab.png\" alt=\"Elasticsearch JSON source advanced pagination tab\" width=\"666\" height=\"299\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-advanced-pagination-tab.png 666w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/Elasticsearch-advanced-pagination-tab-300x135.png 300w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/a><p id=\"caption-attachment-10806\" class=\"wp-caption-text\">Configuration for Elasticsearch advanced pagination tab<\/p><\/div><\/li>\n<\/ol>\n<h3>Loading Elasticsearch API data into SQL Server \/ Other Target<\/h3>\n<div class=\"content_block\" id=\"custom_post_widget-5617\"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination<\/strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.<\/p>\r\n<h3>Step 1: Add Upsert Destination to Data Flow<\/h3>\r\n<ol>\r\n<li>Drag and drop the <strong>Upsert Destination<\/strong> component from the SSIS Toolbox.<\/li>\r\n<li>Connect your source component (e.g., JSON \/ REST \/ Other Source) to the Upsert Destination.<\/li>\r\n<\/ol>\r\n<div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/08\/ssis-data-flow-drag-drop-upsert-destination.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/08\/ssis-data-flow-drag-drop-upsert-destination.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">SSIS - Data Flow - Drang and Drop Upsert Destination Component<\/p>\r\n<\/div>\r\n<h3>Step 2: Configure Target Connection<\/h3>\r\n<ol>\r\n<li>Double-click the <strong>Upsert Destination<\/strong> component to open the configuration window.<\/li>\r\n<li>Under <strong>Connection<\/strong>, select an existing target connection or click <strong>NEW<\/strong> to create a new connection.\r\n<ul>\r\n<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<h3>Step 3: Select or Create Target Table<\/h3>\r\n<ol>\r\n<li>In the <strong>Target Table<\/strong> dropdown, select the table where you want to load data.<\/li>\r\n<li>Optionally, click <strong>NEW<\/strong> to create a new table based on the source columns.<\/li>\r\n<\/ol>\r\n<div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-configuration.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-configuration.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">Configure SSIS Upsert Destination Connection - Loading data (REST \/ SOAP \/ JSON \/ XML \/CSV) into SQL Server or other target using SSIS<\/p>\r\n<\/div>\r\n<h3>Step 4: Map Columns<\/h3>\r\n<ol>\r\n<li>Go to the <strong>Mappings<\/strong> tab.<\/li>\r\n<li>Click <strong>Auto Map<\/strong> to map source columns to target columns by name.<\/li>\r\n<li>Ensure you <strong>check the Primary key column(s)<\/strong> that will determine whether a record is inserted or updated.<\/li>\r\n<li>You can manually adjust the mappings if necessary.<\/li>\r\n<\/ol>\r\n <div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-key.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-key.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">SSIS Upsert Destination - Columns Mappings<\/p>\r\n<\/div>\r\n<h3>Step 5: Save Settings<\/h3>\r\n<ul>\r\n<li>Click <strong>OK<\/strong> to save the Upsert Destination configuration.<\/li>\r\n<\/ul>\r\n<h3>Step 6: Optional: Add Logging or Analysis<\/h3>\r\n<ul>\r\n<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.<\/li>\r\n<\/ul>\r\n<h3>Step 7: Execute the Package<\/h3>\r\n<ul>\r\n<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.<\/li>\r\n<\/ul>\r\n<div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/12\/ssis-upsert-destination-execute.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/12\/ssis-upsert-destination-execute.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">SSIS Upsert Destination Execution<\/p>\r\n<\/div><\/div>\n<h3>Enable Deep Pagination Setting<\/h3>\n<p>By default index, the maximum result window size is 10,000 means you can paginate upto 10000 rows. If you ever want to get more than 10000 result then you have to perform the following steps to change default setting from 10000 to 500000 (that&#8217;s max).<\/p>\n<p>We need to send PUT request to below URL:<\/p>\n<pre class=\"lang:default decode:true\">http:\/\/{elasticsearch-site-url}\/{your-index}\/_settings<\/pre>\n<p>Need to pass below body as I am setting max result window size value as\u00a0500000.<\/p>\n<pre class=\"lang:default decode:true\">{ \"index\" : { \"max_result_window\" : 500000 } }<\/pre>\n<p>And set content-type as JSON (application\/json) and click on Test Request\/Response and it will make the API call and set the max window size.<\/p>\n<div id=\"attachment_8577\" style=\"width: 730px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-rest-api-task-elasticsearch-put-setting-call.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8577\" class=\"wp-image-8577 size-medium_large\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-rest-api-task-elasticsearch-put-setting-call-768x419.png\" alt=\"Rest API Task PUT Call\" width=\"720\" height=\"393\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-rest-api-task-elasticsearch-put-setting-call-768x419.png 768w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-rest-api-task-elasticsearch-put-setting-call-300x164.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-rest-api-task-elasticsearch-put-setting-call-1024x559.png 1024w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/12\/ssis-rest-api-task-elasticsearch-put-setting-call.png 1221w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><p id=\"caption-attachment-8577\" class=\"wp-caption-text\">Rest API Task PUT Call<\/p><\/div>\n<p>That&#8217;s it we have successfully made the call to set the maximum result window size of the index.<\/p>\n<h3><\/h3>\n<h2>Common Errors<\/h2>\n<div class=\"content_block\" id=\"custom_post_widget-1887\"><h3>Truncation related error<\/h3>\r\n<p style=\"text-align: justify;\">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected.\u00a0For detailed instructions on how to fix common metadata related errors read an article \"<a href=\"\/\/zappysys.com\/blog\/handling-ssis-component-metadata-issues\/\" target=\"_blank\" rel=\"noopener\">How to handle SSIS errors (truncation, metadata issues)<\/a>\".<\/p>\r\n\r\n<h3>Authentication related error<\/h3>\r\nAnother frequent error you may get is an authentication error, which happens when you deploy\/copy a package to another machine and run it there. Check <a href=\"#Deployment_to_Production\">the paragraph below<\/a>\u00a0to see why it happens and how to solve this problem.<\/div>\n<h2>Deployment to Production<\/h2>\n<div class=\"content_block\" id=\"custom_post_widget-1932\"><p style=\"text-align: justify;\">In SSIS package <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/integration-services\/security\/access-control-for-sensitive-data-in-packages\" target=\"_blank\" rel=\"noopener\">sensitive data such as tokens and passwords are by default encrypted by SSIS<\/a> with your Windows account which you use to create a package.\u00a0So SSIS will fail to decrypt tokens\/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href=\"https:\/\/zappysys.com\/onlinehelp\/ssis-powerpack\/scr\/ssis-oauth-connection-manager.htm\" target=\"_blank\" rel=\"noopener\">OAuth Connection Manager<\/a>\u00a0or an <a href=\"https:\/\/zappysys.com\/onlinehelp\/ssis-powerpack\/scr\/ssis-http-connection-manager.htm\" target=\"_blank\" rel=\"noopener\">HTTP Connection Manager<\/a> with credentials, etc.), consider using parameters\/variables to pass tokens\/passwords. In this way, you won\u2019t face authentication related errors when a package is deployed to a production server.<\/p>\r\n<p style=\"text-align: justify;\">Check our article on <a href=\"https:\/\/zappysys.com\/blog\/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server\/\" target=\"_blank\" rel=\"noopener\">how to configure packages with sensitive data on your production or development server<\/a>.<\/p><\/div>\n<h2><span id=\"Conclusion\">Conclusion<\/span><\/h2>\n<p>After all, we saw you How to Make Elasticsearch Search API call using SSIS JSON Source and load response into SQL Server. In this article, we have seen that how to make a setting call to set\u00a0the maximum result window of the index. To explore many other scenarios not discussed in this article download\u00a0<a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\">SSIS PowerPack from here (includes 70+ Components)<\/a>.<\/p>\n<h2><span id=\"References\">References<\/span><\/h2>\n<p>Finally, you can use the following links for more information:<\/p>\n<ul>\n<li>Help File:\u00a0<a href=\"https:\/\/zappysys.com\/onlinehelp\/ssis-powerpack\/scr\/json-source.htm\" target=\"_blank\" rel=\"noopener\">JSON Source(REST API or File)<\/a><\/li>\n<li><a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/search.html\" target=\"_blank\" rel=\"noopener\">Elasticsearch Search APIs <\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In our previous article, we see\u00a0how to\u00a0load data into Elastic Search using SSIS. Now let&#8217;s look at how to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. Elasticsearch\u00a0is a powerful engine that allows you to store, aggregate, and, most importantly, search data in a very analytical way. In this tutorial, you [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":1406,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[176,225,17,10],"tags":[215,172,6,12],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>How to read data from ElasticSearch using SSIS | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"How to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. How to set the maximum result window of the index using the Rest API Task.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to read data from ElasticSearch using SSIS | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"How to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. How to set the maximum result window of the index using the Rest API Task.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:published_time\" content=\"2019-12-20T10:02:31+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2025-03-19T08:34:07+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"180\" \/>\r\n\t<meta property=\"og:image:height\" content=\"180\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/\",\"url\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/\",\"name\":\"How to read data from ElasticSearch using SSIS | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png\",\"datePublished\":\"2019-12-20T10:02:31+00:00\",\"dateModified\":\"2025-03-19T08:34:07+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35\"},\"description\":\"How to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. How to set the maximum result window of the index using the Rest API Task.\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png\",\"width\":180,\"height\":180},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to read data from ElasticSearch using SSIS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35\",\"name\":\"ZappySys\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g\",\"caption\":\"ZappySys\"},\"url\":\"https:\/\/zappysys.com\/blog\/author\/hshah\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to read data from ElasticSearch using SSIS | ZappySys Blog","description":"How to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. How to set the maximum result window of the index using the Rest API Task.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/","og_locale":"en_US","og_type":"article","og_title":"How to read data from ElasticSearch using SSIS | ZappySys Blog","og_description":"How to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. How to set the maximum result window of the index using the Rest API Task.","og_url":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/","og_site_name":"ZappySys Blog","article_published_time":"2019-12-20T10:02:31+00:00","article_modified_time":"2025-03-19T08:34:07+00:00","og_image":[{"width":180,"height":180,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png","type":"image\/png"}],"author":"ZappySys","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ZappySys","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/","url":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/","name":"How to read data from ElasticSearch using SSIS | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png","datePublished":"2019-12-20T10:02:31+00:00","dateModified":"2025-03-19T08:34:07+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35"},"description":"How to read data from ElasticSearch using SSIS\u00a0and load response into SQL Server. How to set the maximum result window of the index using the Rest API Task.","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/06\/elasticsearch-logo-180x180.png","width":180,"height":180},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/read-data-from-elasticsearch-using-ssis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to read data from ElasticSearch using SSIS"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35","name":"ZappySys","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g","caption":"ZappySys"},"url":"https:\/\/zappysys.com\/blog\/author\/hshah\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/8573"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=8573"}],"version-history":[{"count":36,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/8573\/revisions"}],"predecessor-version":[{"id":11257,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/8573\/revisions\/11257"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/1406"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=8573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=8573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=8573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}