{"id":2178,"date":"2019-12-17T01:00:00","date_gmt":"2019-12-17T01:00:00","guid":{"rendered":"https:\/\/www.javaadvent.com\/?p=2178"},"modified":"2019-12-12T08:01:03","modified_gmt":"2019-12-12T08:01:03","slug":"elasticsearch-sql","status":"publish","type":"post","link":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html","title":{"rendered":"Elasticsearch SQL"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">The Elasticsearch engine<\/h2>\n\n\n\n<p>Elasticsearch is one of the most widely search engines being used in a number of production deployments today. It is based on the Lucene search library and one of the key features it provides is a JSON-based query DSL on top of Lucene that provides an easier to use mechanism for interacting with the search engine. However the query DSL is very specific to Elasticsearch. The SQL support introduced in Elasticsearch 6.3 has brought a standard mechanism for running queries against the search engine and has been one step further towards easier adoption by developers already familiar with SQL. Although SQL has been initially designed for use with relational database management systems it has been implemented in a wide range of other systems (such as NoSQL databases). Take for example SQL supported provided in a distributed data processing engine like Apache Spark or a distributed cache-based computation system like Apache Ignite where SQL is one of the core query facilities provided. In this article we will explore how Elasticsearch SQL works.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Preliminary setup<\/h2>\n\n\n\n<p>In order to try the examples in the article you need to have a local Elasticsearch (at least 6.3) instance started. In this article we are going to use latest Elasticsearch 7.5. We will create a <strong>posts<\/strong> index that holds posts from a forum. We will be using the Elasticsearch Java client to feed data into the index and we are not going to provide explicit mapping for the fields of the index (for the purpose of simplicity we will let Elasticsearch automatically create it for us). First we will create a Maven project with a dependency to the Elasticsearch Java high level client (the old Elasticsearch HTTP client is deprecated and planned for removal in Elasticsearch 8.0):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;dependency&gt;\n    &amp;lt;groupId&gt;org.elasticsearch.client&amp;lt;\/groupId&gt;\n    &amp;lt;artifactId&gt;elasticsearch-rest-high-level-client&amp;lt;\/artifactId&gt;\n    &amp;lt;version&gt;7.5.0&amp;lt;\/version&gt;\n&amp;lt;\/dependency&gt;\n<\/pre><\/div>\n\n\n<p>We will create 10000 generated post documents in the <strong>posts<\/strong> index using the following piece of code:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n\tRestHighLevelClient client = new RestHighLevelClient(\n\t\t        RestClient.builder(\n\t\t                new HttpHost(&quot;localhost&quot;, 9200, &quot;http&quot;)));\n\t\t\n\t\tString&#x5B;] possibleUsers = new String&#x5B;] {&quot;Martin&quot;, &quot;Jim&quot;, &quot;John&quot;};\n\t\tString&#x5B;] possibleDates = new String&#x5B;] {&quot;2019-12-15&quot;, &quot;2019-12-16&quot;, &quot;2019-12-17&quot;};\n\t\tString&#x5B;] possibleMessages = new String&#x5B;] {&quot;Hello, Javaadvent !&quot;,\n\t\t\t\t&quot;Cool set of blog posts. We want more !&quot;,\n\t\t\t\t&quot;Elasticsearch SQL is great.&quot;};\n\t\t\n\t\tfor(int i = 1; i &lt;= 10000; i++) {\n\t\t\tMap&lt;String, Object&gt; jsonMap = new HashMap&lt;&gt;();\n\t\t\tjsonMap.put(&quot;user&quot;, possibleUsers&#x5B;ThreadLocalRandom.current().nextInt(0, 3)]);\n\t\t\tjsonMap.put(&quot;date&quot;, possibleDates&#x5B;ThreadLocalRandom.current().nextInt(0, 3)]);\n\t\t\tjsonMap.put(&quot;message&quot;, possibleMessages&#x5B;ThreadLocalRandom.current().nextInt(0, 3)]);\n\t\t\tIndexRequest request = new IndexRequest(&quot;posts&quot;)\n\t\t\t    .id(String.valueOf(i)).source(jsonMap); \n\t\t\tclient.index(request, RequestOptions.DEFAULT);\n\t\t}\n\t\t\n\t\tclient.close();\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Running the SQL queries<\/h2>\n\n\n\n<p>We can use Kibana to query all the documents where the username is <strong>Martin<\/strong> as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nPOST \/_sql?format=txt\n{\n    &quot;query&quot;: &quot;SELECT * FROM posts where user = 'Martin'&quot;\n}\n<\/pre><\/div>\n\n\n<p>Another example would be to count all the documents that contain the word <strong>Javaadvent<\/strong> in the <strong>message<\/strong> field:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nPOST \/_sql?format=txt\n{\n    &quot;query&quot;: &quot;SELECT count(*) FROM posts where message like '%Javaadvent%'&quot;\n}\n<\/pre><\/div>\n\n\n<p>Now if you want to run the above queries in your Java\napplication you have a few options:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>run it using Elasticsearch JDBC driver. This\noption however is available only with platinum and enterprise subscriptions;<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>REST client calling the Elasticsearch SQL\nendpoint. This option is the one to choose if you only have the basic (free)\nElasticsearch option.<\/li><\/ul>\n\n\n\n<p>You can use pretty much any REST client for Java in order to use the second option but we will use the low-level Elasticsearch REST client:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;dependency&gt;\n    &amp;lt;groupId&gt;org.elasticsearch.client&amp;lt;\/groupId&gt;\n    &amp;lt;artifactId&gt;elasticsearch-rest-client&amp;lt;\/artifactId&gt;\n    &amp;lt;version&gt;7.5.0&amp;lt;\/version&gt;\n&amp;lt;\/dependency&gt;\n<\/pre><\/div>\n\n\n<p>The following block of code returns only 10 documents from the <strong>posts<\/strong> index:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n\t\tRestClient restClient = RestClient.builder(\n\t\t\t    new HttpHost(&quot;localhost&quot;, 9200, &quot;http&quot;)).build();\n\t\t\n\t\tRequest request = new Request(&quot;POST&quot;,  &quot;\/_sql&quot;);\n\t\trequest.setJsonEntity(&quot;{\\&quot;query\\&quot;:\\&quot;SELECT * FROM posts limit 10\\&quot;}&quot;);\n\t\tResponse response = restClient.performRequest(request);\n\t\tString responseBody = EntityUtils.toString(response.getEntity()); \n\t\tSystem.out.println(responseBody);\n\t\trestClient.close();\n\n<\/pre><\/div>\n\n\n<p>To see how is the SQL query executed behind the scenes you can use the translate API provided under the \/_sql\/translate endpoint. We can run the following in Kibana If we want to see what is the query DSL generated for the previous SQL query:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nPOST \/_sql\/translate\n{\n    &quot;query&quot;: &quot;SELECT * FROM posts limit 10&quot;,\n    &quot;fetch_size&quot;: 10\n}\n<\/pre><\/div>\n\n\n<p>And we should get a result similar to the following:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  &quot;size&quot; : 10,\n  &quot;_source&quot; : {\n    &quot;includes&quot; : &#x5B;\n      &quot;message&quot;,\n      &quot;user&quot;\n    ],\n    &quot;excludes&quot; : &#x5B; ]\n  },\n  &quot;docvalue_fields&quot; : &#x5B;\n    {\n      &quot;field&quot; : &quot;date&quot;,\n      &quot;format&quot; : &quot;epoch_millis&quot;\n    }\n  ],\n  &quot;sort&quot; : &#x5B;\n    {\n      &quot;_doc&quot; : {\n        &quot;order&quot; : &quot;asc&quot;\n      }\n    }\n  ]\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Elasticsearch SQL features <\/h2>\n\n\n\n<p>We demonstrated how we can execute basic SQL queries. The\nElasticsearch SQL engine is quite rich and includes:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>a number of formats for the SQL query response such as csv, json, txt, yaml and others;<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>applying additional query DSL filtering along with the Elasticsearch SQL;<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li>a CLI provided by the <strong>elasticsearch-sql-cli<\/strong> utility where you can execute SQL queries directly.<\/li><\/ul>\n\n\n\n<p>In terms of the SQL implementation itself you can refer to\nthe <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/sql-commands.html\">supported\nSQL commands<\/a> and <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/sql-functions.html\">SQL\nfunctions and operators reference documentation<\/a> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion <\/h2>\n\n\n\n<p>In this article we demonstrated how to use Elasticsearch SQL\nto interact with the Elasticsearch engine. There are high chances that this\nmechanism becomes more preferable to use than the JSON-based query DSL. However\nElasticsearch SQL is not a replacement for it but is rather built on top of it and\nfulfills to plethora of features provided by the search engine. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Elasticsearch engine Elasticsearch is one of the most widely search engines being used in a number of production deployments today. It is based on the Lucene search library and one of the key features it provides is a JSON-based query DSL on top of Lucene that provides an easier to use mechanism for interacting [&hellip;]<\/p>\n","protected":false},"author":50,"featured_media":1097,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[381],"tags":[484,251,311,485],"coauthors":[354],"class_list":["post-2178","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-christmas-2019-is-coming","tag-elasticsearch","tag-java","tag-rest","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Elasticsearch SQL - JVM Advent<\/title>\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.javaadvent.com\/2019\/12\/elasticsearch-sql.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Elasticsearch SQL - JVM Advent\" \/>\n<meta property=\"og:description\" content=\"The Elasticsearch engine Elasticsearch is one of the most widely search engines being used in a number of production deployments today. It is based on the Lucene search library and one of the key features it provides is a JSON-based query DSL on top of Lucene that provides an easier to use mechanism for interacting [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html\" \/>\n<meta property=\"og:site_name\" content=\"JVM Advent\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Java-Advent-Calendar-229536173843473\/\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-17T01:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png\" \/>\n\t<meta property=\"og:image:width\" content=\"280\" \/>\n\t<meta property=\"og:image:height\" content=\"280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Martin Toshev\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javaadvent\" \/>\n<meta name=\"twitter:site\" content=\"@javaadvent\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Martin Toshev\" \/>\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.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html\"},\"author\":{\"name\":\"Martin Toshev\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#\\\/schema\\\/person\\\/eb708044dd802fabc1b5c9d4e9ac2959\"},\"headline\":\"Elasticsearch SQL\",\"datePublished\":\"2019-12-17T01:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html\"},\"wordCount\":644,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2017\\\/12\\\/duke17.png?fit=280%2C280&ssl=1\",\"keywords\":[\"elasticsearch\",\"java\",\"REST\",\"sql\"],\"articleSection\":[\"2019\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html\",\"url\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html\",\"name\":\"Elasticsearch SQL - JVM Advent\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2017\\\/12\\\/duke17.png?fit=280%2C280&ssl=1\",\"datePublished\":\"2019-12-17T01:00:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#\\\/schema\\\/person\\\/eb708044dd802fabc1b5c9d4e9ac2959\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2017\\\/12\\\/duke17.png?fit=280%2C280&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.javaadvent.com\\\/content\\\/uploads\\\/2017\\\/12\\\/duke17.png?fit=280%2C280&ssl=1\",\"width\":280,\"height\":280},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/2019\\\/12\\\/elasticsearch-sql.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javaadvent.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Elasticsearch SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javaadvent.com\\\/\",\"name\":\"JVM Advent\",\"description\":\"The JVM Programming Advent Calendar\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javaadvent.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javaadvent.com\\\/#\\\/schema\\\/person\\\/eb708044dd802fabc1b5c9d4e9ac2959\",\"name\":\"Martin Toshev\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a235abf761a167024d17889a980406ccd19f83785b09ee66cf15b0bf90784899?s=96&d=retro&r=g3e6ba52e2c53d134111bf2113ed8a2fb\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a235abf761a167024d17889a980406ccd19f83785b09ee66cf15b0bf90784899?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a235abf761a167024d17889a980406ccd19f83785b09ee66cf15b0bf90784899?s=96&d=retro&r=g\",\"caption\":\"Martin Toshev\"},\"url\":\"https:\\\/\\\/www.javaadvent.com\\\/author\\\/martivtoshev\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Elasticsearch SQL - JVM Advent","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.javaadvent.com\/2019\/12\/elasticsearch-sql.html","og_locale":"en_US","og_type":"article","og_title":"Elasticsearch SQL - JVM Advent","og_description":"The Elasticsearch engine Elasticsearch is one of the most widely search engines being used in a number of production deployments today. It is based on the Lucene search library and one of the key features it provides is a JSON-based query DSL on top of Lucene that provides an easier to use mechanism for interacting [&hellip;]","og_url":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html","og_site_name":"JVM Advent","article_publisher":"https:\/\/www.facebook.com\/Java-Advent-Calendar-229536173843473\/","article_published_time":"2019-12-17T01:00:00+00:00","og_image":[{"width":280,"height":280,"url":"https:\/\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png","type":"image\/png"}],"author":"Martin Toshev","twitter_card":"summary_large_image","twitter_creator":"@javaadvent","twitter_site":"@javaadvent","twitter_misc":{"Written by":"Martin Toshev","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#article","isPartOf":{"@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html"},"author":{"name":"Martin Toshev","@id":"https:\/\/www.javaadvent.com\/#\/schema\/person\/eb708044dd802fabc1b5c9d4e9ac2959"},"headline":"Elasticsearch SQL","datePublished":"2019-12-17T01:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html"},"wordCount":644,"commentCount":0,"image":{"@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png?fit=280%2C280&ssl=1","keywords":["elasticsearch","java","REST","sql"],"articleSection":["2019"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html","url":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html","name":"Elasticsearch SQL - JVM Advent","isPartOf":{"@id":"https:\/\/www.javaadvent.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#primaryimage"},"image":{"@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png?fit=280%2C280&ssl=1","datePublished":"2019-12-17T01:00:00+00:00","author":{"@id":"https:\/\/www.javaadvent.com\/#\/schema\/person\/eb708044dd802fabc1b5c9d4e9ac2959"},"breadcrumb":{"@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#primaryimage","url":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png?fit=280%2C280&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png?fit=280%2C280&ssl=1","width":280,"height":280},{"@type":"BreadcrumbList","@id":"https:\/\/www.javaadvent.com\/2019\/12\/elasticsearch-sql.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javaadvent.com\/"},{"@type":"ListItem","position":2,"name":"Elasticsearch SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.javaadvent.com\/#website","url":"https:\/\/www.javaadvent.com\/","name":"JVM Advent","description":"The JVM Programming Advent Calendar","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javaadvent.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.javaadvent.com\/#\/schema\/person\/eb708044dd802fabc1b5c9d4e9ac2959","name":"Martin Toshev","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a235abf761a167024d17889a980406ccd19f83785b09ee66cf15b0bf90784899?s=96&d=retro&r=g3e6ba52e2c53d134111bf2113ed8a2fb","url":"https:\/\/secure.gravatar.com\/avatar\/a235abf761a167024d17889a980406ccd19f83785b09ee66cf15b0bf90784899?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a235abf761a167024d17889a980406ccd19f83785b09ee66cf15b0bf90784899?s=96&d=retro&r=g","caption":"Martin Toshev"},"url":"https:\/\/www.javaadvent.com\/author\/martivtoshev"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2017\/12\/duke17.png?fit=280%2C280&ssl=1","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":3567,"url":"https:\/\/www.javaadvent.com\/2022\/12\/elasticsearch-internals.html","url_meta":{"origin":2178,"position":0},"title":"Elasticsearch Internals","author":"Martin Toshev","date":"December 21, 2022","format":false,"excerpt":"Elasticsearch is as one of the leading solutions for Enterprise search (and not only). As such it is worth understanding how does it work internally in order to better leverage its capabilities. Let's follow a short journey to understand how does Elasticsearch work internally. At the beginning there was only\u2026","rel":"","context":"In &quot;2022&quot;","block_context":{"text":"2022","link":"https:\/\/www.javaadvent.com\/category\/jvm-advent-2022"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-21.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-21.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-21.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-21.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3569,"url":"https:\/\/www.javaadvent.com\/2022\/12\/elasticsearch-8x-latest-and-greatest.html","url_meta":{"origin":2178,"position":1},"title":"Elasticsearch 8x latest and greatest","author":"Martin Toshev","date":"December 14, 2022","format":false,"excerpt":"Elasticsearch 8.0 became generaly available at the beginning of the year. The cornerstone of the 8x releases have been a number of performance, stability and security improvements. Apart from that new capabilities especially in the area of machine learning and NLP have also been introduced. In this article we will\u2026","rel":"","context":"In &quot;2022&quot;","block_context":{"text":"2022","link":"https:\/\/www.javaadvent.com\/category\/jvm-advent-2022"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-14.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-14.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-14.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-14.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":2360,"url":"https:\/\/www.javaadvent.com\/2020\/12\/how-to-keep-elasticsearch-in-sync-with-relational-databases.html","url_meta":{"origin":2178,"position":2},"title":"How to Keep Elasticsearch in Sync with Relational Databases?","author":"H\u00fcseyin Akdo\u011fan","date":"December 6, 2020","format":false,"excerpt":"Many businesses are looking to take advantage of Elasticsearch's powerful search capabilities using it in close relationship with existing relational databases. In this context, it\u2019s not rare to use Elasticsearch as a caching layer. At this point, a basic and important need arises which is synchronizing Elasticsearch with the database.\u2026","rel":"","context":"In &quot;2020&quot;","block_context":{"text":"2020","link":"https:\/\/www.javaadvent.com\/category\/2020"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2020\/12\/%D0%9A%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B0.jpg?fit=1024%2C770&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2020\/12\/%D0%9A%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B0.jpg?fit=1024%2C770&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2020\/12\/%D0%9A%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B0.jpg?fit=1024%2C770&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2020\/12\/%D0%9A%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B0.jpg?fit=1024%2C770&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":4470,"url":"https:\/\/www.javaadvent.com\/2023\/12\/free-enterprise-search-with-opensearch.html","url_meta":{"origin":2178,"position":3},"title":"Free enterprise search with OpenSearch","author":"Martin Toshev","date":"December 8, 2023","format":false,"excerpt":"At the beginning there was only Elasticsearch ... It all started when Elasticsearch and Kibana license was changed from Apache 2.0 to EL (Elastic License) and SSPL (Server Side Public License). OpenSearch (formerly OpenDistro for Elasticsearch) is a fork of the Apache 2.0 licensed versions (7.10.2) of Elasticsearch and Kibana\u2026","rel":"","context":"In &quot;2023&quot;","block_context":{"text":"2023","link":"https:\/\/www.javaadvent.com\/category\/2023"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-8.png?fit=800%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-8.png?fit=800%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-8.png?fit=800%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2021\/12\/Feature-Image-Day-8.png?fit=800%2C800&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":16,"url":"https:\/\/www.javaadvent.com\/2014\/12\/how-jooq-leverages-generic-type-safety-in-its-dsl.html","url_meta":{"origin":2178,"position":4},"title":"How jOOQ Leverages Generic Type Safety in its DSL","author":"Lukas Eder","date":"December 17, 2014","format":false,"excerpt":"In this year's Java Advent Calendar, we're thrilled to have been asked to feature a mini-series showing you a couple of advanced and very interesting topics that we've been working on when developing jOOQ.The series consists of:Dec 17: How jOOQ Leverages Generic Type Safety in its DSLDec 18: How jOOQ\u2026","rel":"","context":"In &quot;DSL&quot;","block_context":{"text":"DSL","link":"https:\/\/www.javaadvent.com\/category\/dsl"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2014\/12\/cable-mess.png?fit=921%2C628&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2014\/12\/cable-mess.png?fit=921%2C628&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2014\/12\/cable-mess.png?fit=921%2C628&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.javaadvent.com\/content\/uploads\/2014\/12\/cable-mess.png?fit=921%2C628&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":15,"url":"https:\/\/www.javaadvent.com\/2014\/12\/how-jooq-allows-for-fluent-functional-relational-interactions-in-java-8.html","url_meta":{"origin":2178,"position":5},"title":"How jOOQ Allows for Fluent Functional-Relational Interactions in Java 8","author":"Lukas Eder","date":"December 18, 2014","format":false,"excerpt":"In this year's Java Advent Calendar, we're thrilled to have been asked to feature a mini-series showing you a couple of advanced and very interesting topics that we've been working on when developing jOOQ.The series consists of: Dec 17: How jOOQ Leverages Generic Type Safety in its DSLDec 18: How\u2026","rel":"","context":"In &quot;functional programming&quot;","block_context":{"text":"functional programming","link":"https:\/\/www.javaadvent.com\/category\/functional-programming"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts\/2178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/comments?post=2178"}],"version-history":[{"count":6,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts\/2178\/revisions"}],"predecessor-version":[{"id":2192,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/posts\/2178\/revisions\/2192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/media\/1097"}],"wp:attachment":[{"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/media?parent=2178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/categories?post=2178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/tags?post=2178"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.javaadvent.com\/wp-json\/wp\/v2\/coauthors?post=2178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}