{"id":70076,"date":"2017-10-27T16:00:00","date_gmt":"2017-10-27T13:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=70076"},"modified":"2017-10-27T10:45:28","modified_gmt":"2017-10-27T07:45:28","slug":"aggregate-index-data-elasticsearch-using-logstash-jdbc","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html","title":{"rendered":"Aggregate and Index Data into Elasticsearch using Logstash, JDBC"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>In my previous posts <a href=\"https:\/\/www.javacodegeeks.com\/2017\/03\/index-data-relational-database-elasticsearch-1.html\">here<\/a> and <a href=\"https:\/\/sanaulla.info\/2017\/04\/02\/index-data-from-a-relational-database-into-elasticsearch-2\/\">here<\/a> I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer library. In the first article <a href=\"https:\/\/www.javacodegeeks.com\/2017\/03\/index-data-relational-database-elasticsearch-1.html\">here<\/a> I mentioned some of the shortcomings of using the importer library which I have copied here:<\/p>\n<ul>\n<li>No support for ES version 5 and above<\/li>\n<li>There is a possibility of duplicate objects in the\u00a0array of nested objects. But de-duplication can be handled at the application layer.<\/li>\n<li>There can be a\u00a0possibility of delay in support for latest ES versions.<\/li>\n<\/ul>\n<p>All the above shortcomings can be overcome by using Logstash and its following plugins:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/plugins-inputs-jdbc.html\">JDBC Input plugin<\/a> \u2013 For reading the data from SQL DB using JDBC<\/li>\n<li><a href=\"https:\/\/www.elastic.co\/guide\/en\/logstash\/current\/plugins-filters-aggregate.html\">Aggregate Filter plugin<\/a> \u2013 this is for aggregating the rows from SQL DB into nested objects.<\/li>\n<\/ul>\n<h2><strong>Creating\u00a0Elasticsearch Index<\/strong><\/h2>\n<p>I will be using the latest ES version i.e 5.63 which can be downloaded from Elasticsearch website <a href=\"https:\/\/www.elastic.co\/downloads\/elasticsearch\">here<\/a>. We will create an index world_v2 using the mapping available <a href=\"https:\/\/gist.github.com\/sanaulla123\/b0b182518ade604b69090509b4779d01\">here<\/a>.<\/p>\n<pre class=\"brush:java\">$ curl -XPUT --header \"Content-Type: application\/json\" \r\n    http:\/\/localhost:9200\/world_v2 -d @world-index.json<\/pre>\n<p>or using Postman REST client as shown below:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/1-1.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-70080\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/1-1.png\" alt=\"\" width=\"625\" height=\"488\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/1-1.png 625w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/1-1-300x234.png 300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>To confirm that the index has been created successfully, open this URL\u00a0http:\/\/localhost:9200\/world_v2 in the browser to get something similar to as shown below:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/2.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-70081\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/2.png\" alt=\"\" width=\"402\" height=\"562\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/2.png 402w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/2-215x300.png 215w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><\/a><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>Creating Logstash Configuration File<\/h2>\n<p>We should be picking the equivalent logstash version which would be 5.6.3 and it can be downloaded from <a href=\"https:\/\/www.elastic.co\/downloads\/logstash\">here<\/a>. And then we need to install the\u00a0JDBC input plugin, Aggregate filter plugin and Elasticsearch output plugin using the following commands:<\/p>\n<pre class=\"brush:java\">bin\/logstash-plugin install logstash-input-jdbc\r\nbin\/logstash-plugin install logstash-filter-aggregate\r\nbin\/logstash-plugin install logstash-output-elasticsearch<\/pre>\n<p>We need to copy the following into the <em>bin<\/em> directory to be able to run our configuration which we will define next:<\/p>\n<ol>\n<li>Download the MySQL JDBC jar from <a href=\"http:\/\/central.maven.org\/maven2\/mysql\/mysql-connector-java\/5.1.6\/mysql-connector-java-5.1.6.jar\">here<\/a>.<\/li>\n<li>Download the file containing the SQL query for fetching the data from <a href=\"https:\/\/gist.github.com\/sanaulla123\/d9f4b8702991fc7afa52955445b3c2ff\">here<\/a>.<\/li>\n<\/ol>\n<p>We will copy the above into Logstash\u2019s <em>bin<\/em> directory or any directory where you will have the logstash configuration file, this is because we are referring to these two files in the configuration using their relative paths. Below is the Logstash configuration file:<\/p>\n<pre class=\"brush:java\">input {\r\n  jdbc {\r\n    jdbc_connection_string =&gt; \"jdbc:mysql:\/\/localhost:3306\/world\"\r\n    jdbc_user =&gt; \"root\"\r\n    jdbc_password =&gt; \"mohamed\"\r\n    # The path to downloaded jdbc driver\r\n    jdbc_driver_library =&gt; \"mysql-connector-java-5.1.6.jar\"\r\n    jdbc_driver_class =&gt; \"Java::com.mysql.jdbc.Driver\"\r\n    # The path to the file containing the query\r\n    statement_filepath =&gt; \"world-logstash.sql\"\r\n  }\r\n}\r\nfilter {\r\n  aggregate {\r\n    task_id =&gt; \"%{code}\"\r\n    code =&gt; \"\r\n      map['code'] = event.get('code')\r\n      map['name'] = event.get('name')\r\n      map['continent'] = event.get('continent')\r\n      map['region'] = event.get('region')\r\n      map['surface_area'] = event.get('surface_area')\r\n      map['year_of_independence'] = event.get('year_of_independence')\r\n      map['population'] = event.get('population')\r\n      map['life_expectancy'] = event.get('life_expectancy')\r\n      map['government_form'] = event.get('government_form')\r\n      map['iso_code'] = event.get('iso_code')\r\n \r\n      map['capital'] = {\r\n        'id' =&gt; event.get('capital_id'), \r\n        'name' =&gt; event.get('capital_name'),\r\n        'district' =&gt; event.get('capital_district'),\r\n        'population' =&gt; event.get('capital_population')\r\n      }\r\n \r\n      map['cities_list'] ||= []\r\n      map['cities'] ||= []\r\n      if (event.get('cities_id') != nil)\r\n        if !( map['cities_list'].include? event.get('cities_id') ) \r\n          map['cities_list'] &lt;&lt; event.get('cities_id')\r\n \r\n          map['cities'] &lt;&lt; {\r\n            'id' =&gt; event.get('cities_id'), \r\n            'name' =&gt; event.get('cities_name'),\r\n            'district' =&gt; event.get('cities_district'),\r\n            'population' =&gt; event.get('cities_population')\r\n          }\r\n        end\r\n      end\r\n \r\n      map['languages_list'] ||= []\r\n      map['languages'] ||= []\r\n      if (event.get('languages_language') != nil)\r\n        if !( map['languages_list'].include? event.get('languages_language') )\r\n          map['languages_list'] &lt;&lt; event.get('languages_language')\r\n \r\n          map['languages'] &lt;&lt; {\r\n            'language' =&gt; event.get('languages_language'), \r\n            'official' =&gt; event.get('languages_official'),\r\n            'percentage' =&gt; event.get('languages_percentage')\r\n          }\r\n        end\r\n      end\r\n      event.cancel()\r\n    \"\r\n    push_previous_map_as_event =&gt; true\r\n    timeout =&gt; 5\r\n  }\r\n  mutate { \r\n    remove_field =&gt; [\"cities_list\", \"languages_list\"]\r\n  }\r\n}\r\noutput {\r\n  elasticsearch {\r\n    document_id =&gt; \"%{code}\"\r\n    document_type =&gt; \"world\"\r\n    index =&gt; \"world_v2\"\r\n    codec =&gt; \"json\"\r\n    hosts =&gt; [\"127.0.0.1:9200\"]\r\n  }\r\n}<\/pre>\n<p>We place the configuration file in the logstash\u2019s bin directory. We run the logstash pipeline using the following command:<\/p>\n<pre class=\"brush:java\">$ logstash -w 1 -f world-logstash.conf<\/pre>\n<p>We are using 1 worker because multiple workers can break the aggregations as the aggregation happens based on the sequence of events having a common country code. We will see the following output on successful completion of the logstash pipeline:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/3.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-70083\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/3.png\" alt=\"\" width=\"625\" height=\"443\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/3.png 625w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/3-300x213.png 300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>Open the following URL <a href=\"http:\/\/localhost:9200\/world_v2\/world\/IND\" rel=\"nofollow\">http:\/\/localhost:9200\/world_v2\/world\/IND<\/a> in the browser to view the information for India indexed in Elasticsearch as shown below:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/4.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-70084\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/4.png\" alt=\"\" width=\"412\" height=\"563\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/4.png 412w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/10\/4-220x300.png 220w\" sizes=\"(max-width: 412px) 100vw, 412px\" \/><\/a><\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Mohamed Sanaulla, partner at our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"https:\/\/sanaulla.info\/2017\/10\/27\/aggregate-and-index-data-into-elasticsearch-using-logstash-jdbc\/\" target=\"_blank\" rel=\"noopener\">Aggregate and Index Data into Elasticsearch using Logstash, JDBC<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer library. In the first article here I mentioned some of the shortcomings of using the importer library which I have copied here: No support for ES version 5 &hellip;<\/p>\n","protected":false},"author":24,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[732],"class_list":["post-70076","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-elasticsearch"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Aggregate and Index Data into Elasticsearch using Logstash, JDBC - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Aggregate and Index Data into Elasticsearch using Logstash, JDBC - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-27T13:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Mohamed Sanaulla\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mohamed Sanaulla\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\"},\"author\":{\"name\":\"Mohamed Sanaulla\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/d27ef53124d64097c81168263af5a7f7\"},\"headline\":\"Aggregate and Index Data into Elasticsearch using Logstash, JDBC\",\"datePublished\":\"2017-10-27T13:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\"},\"wordCount\":461,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Elasticsearch\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\",\"name\":\"Aggregate and Index Data into Elasticsearch using Logstash, JDBC - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2017-10-27T13:00:00+00:00\",\"description\":\"Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/10\\\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Aggregate and Index Data into Elasticsearch using Logstash, JDBC\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/d27ef53124d64097c81168263af5a7f7\",\"name\":\"Mohamed Sanaulla\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/64131fe9e9472b8852abf595cbbf3a8a2a5e86569fa1349eed92b2a32f9104c1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/64131fe9e9472b8852abf595cbbf3a8a2a5e86569fa1349eed92b2a32f9104c1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/64131fe9e9472b8852abf595cbbf3a8a2a5e86569fa1349eed92b2a32f9104c1?s=96&d=mm&r=g\",\"caption\":\"Mohamed Sanaulla\"},\"sameAs\":[\"http:\\\/\\\/blog.sanaulla.info\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Mohamed-Sanaulla\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Aggregate and Index Data into Elasticsearch using Logstash, JDBC - Java Code Geeks","description":"Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer","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:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html","og_locale":"en_US","og_type":"article","og_title":"Aggregate and Index Data into Elasticsearch using Logstash, JDBC - Java Code Geeks","og_description":"Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer","og_url":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-10-27T13:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Mohamed Sanaulla","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Mohamed Sanaulla","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html"},"author":{"name":"Mohamed Sanaulla","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/d27ef53124d64097c81168263af5a7f7"},"headline":"Aggregate and Index Data into Elasticsearch using Logstash, JDBC","datePublished":"2017-10-27T13:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html"},"wordCount":461,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Elasticsearch"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html","url":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html","name":"Aggregate and Index Data into Elasticsearch using Logstash, JDBC - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2017-10-27T13:00:00+00:00","description":"Introduction In my previous posts here and here I showed you how to index data into Elasticsearch from a SQL DB using JDBC and Elasticsearch JDBC importer","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2017\/10\/aggregate-index-data-elasticsearch-using-logstash-jdbc.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Aggregate and Index Data into Elasticsearch using Logstash, JDBC"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/d27ef53124d64097c81168263af5a7f7","name":"Mohamed Sanaulla","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/64131fe9e9472b8852abf595cbbf3a8a2a5e86569fa1349eed92b2a32f9104c1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/64131fe9e9472b8852abf595cbbf3a8a2a5e86569fa1349eed92b2a32f9104c1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/64131fe9e9472b8852abf595cbbf3a8a2a5e86569fa1349eed92b2a32f9104c1?s=96&d=mm&r=g","caption":"Mohamed Sanaulla"},"sameAs":["http:\/\/blog.sanaulla.info"],"url":"https:\/\/www.javacodegeeks.com\/author\/Mohamed-Sanaulla"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/70076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=70076"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/70076\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=70076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=70076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=70076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}