{"id":48,"date":"2023-12-12T13:19:44","date_gmt":"2023-12-12T13:19:44","guid":{"rendered":"https:\/\/blog.200oksolutions.com\/?p=48"},"modified":"2026-07-13T12:55:19","modified_gmt":"2026-07-13T12:55:19","slug":"serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java","status":"publish","type":"post","link":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/","title":{"rendered":"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA."},"content":{"rendered":"\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA.\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/ySd7hQAOZIg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">AWS Lambda is a serverless computing service provided by Amazon Web Services (AWS). It allows you to run code in response to events without having to manage servers. With AWS Lambda, you can build applications that automatically scale, handle tasks, and respond to events as needed, all while only paying for the compute time consumed during the execution of your code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Elasticsearch is an open-source distributed search and analytics engine. It is designed to store, search, and analyze large volumes of data quickly and in near real-time. Elasticsearch is part of the Elastic Stack, which includes components like Logstash, Kibana, and Beats, often used together for various data-related tasks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Steps to create Lambda-based API for ElasticSearch using API Gateway.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Prerequisites:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1 AWS Account: <\/strong>You need an AWS account to create Lambda functions and other AWS services.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2 Elasticsearch Domain: <\/strong>Create an Amazon Elasticsearch domain using the AWS Management Console. Note down the endpoint URL of your Elasticsearch cluster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3 Java Development Environment: <\/strong>Make sure you have Java and Maven installed on your local machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4<\/strong> <strong>AWS CLI:<\/strong> Install the AWS Command Line Interface to interact with AWS services.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step-by-Step Guide:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Add Dependencies:<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In your Java project, you need to add the <strong>Elasticsearch<\/strong> Java High-Level REST Client , <strong>AWS Lambda Java Core, AWS Java SDK<\/strong> as a dependency. If you&#8217;re using Maven, add the following to your <strong>pom.xml:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-silver-blue-background-color has-background is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code has-black-color has-text-color has-link-color wp-elements-5f9f78ab95c3213e125ae56cecaa2c94\"><code><strong>&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">dependencies<\/mark>&gt;\n&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">dependency<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">groupId<\/mark>&gt;org.elasticsearch.client&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/groupId<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">artifactId<\/mark>&gt;elasticsearch-rest-high-level-client&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/artifactId<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">version<\/mark>&gt;7.17.6&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/version<\/mark>&gt; &lt;!-- Use the version compatible with your Elasticsearch cluster --&gt;\n\t&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/dependency<\/mark>&gt;\n&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">dependency<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">groupId<\/mark>&gt;com.amazonaws&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/groupId<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">artifactId<\/mark>&gt;aws-lambda-java-core&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/artifactId<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">version<\/mark>&gt;1.2.1&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/version<\/mark>&gt;\n\t&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/dependency<\/mark>&gt;\n&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">dependency<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">groupId<\/mark>&gt;com.amazonaws&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/groupId<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">artifactId<\/mark>&gt;aws-java-sdk-s3&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/artifactId<\/mark>&gt;\n\t    &lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">version<\/mark>&gt;1.12.400&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/version<\/mark>&gt;\n\t&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/dependency<\/mark>&gt;\n&lt;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">\/dependencies<\/mark>&gt;<\/strong><\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure to replace the version with the one compatible with your Elasticsearch version.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Create Lambda Function:<\/strong><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"664\" height=\"233\" src=\"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/image-1.png\" alt=\"In your Java project, you need to add the Elasticsearch Java High-Level REST Client , AWS Lambda Java Core, AWS Java SDK as a dependency. If you're using Maven, add the following to your pom.xml:\" class=\"wp-image-50\" style=\"width:812px;height:auto\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Configure the Elasticsearch Client:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>Step 1: Create ES Client Request as mentioned below.<\/strong>\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);font-family: inherit; font-size: inherit;\" class=\"has-inline-color has-purple-color\">import<\/mark><span style=\"background-color: initial; font-family: inherit; font-size: inherit; color: var(--wp--preset--color--text-primary);\"> org.elasticsearch.client.Request;<\/span><code>Request request = <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">new<\/mark> Request(\"GET\", \"your_index\/_search\");\nTo get list of indexes use: request = <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">new<\/mark> Request(\"GET\",\"_cat\/indices\");<\/code>\n\n<strong>Step 2: Instantiate AWS Signer with necessary parameters,<\/strong> \n\n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> com.amazonaws.auth.AWS4Signer;\nAWS4Signer signer = <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">new<\/mark> AWS4Signer();\nsigner.setServiceName(\"aws.serviceName\");\nsigner.setRegionName(\"aws.region\");\n\n<strong>Step 3: Intercept Request with AWS Credentials<\/strong>\n      <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> org.apache.http.HttpRequestInterceptor;\n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> com.amazonaws.auth.AWSStaticCredentialsProvider;\n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> com.amazonaws.auth.BasicAWSCredentials;<\/code>\n<code>Http RequestInterceptor interceptor = <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">new<\/mark> AWSRequestSigningApacheInterceptor(\"aws.serviceName\",    \nsigner,<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">new<\/mark> AWSStaticCredentialsProvider(<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">new<\/mark> BasicAWSCredentials(\"aws.accessKey\",\"aws.secretKey\")));<\/code>\n<strong>Step 4: Create an Elasticsearch client. You can set up the client with connection details,such<\/strong> <strong>as<\/strong> <strong>the Elasticsearch cluster's endpoint and any necessary authentication.<\/strong>\n\n<mark style=\"background-color:rgba(0, 0, 0, 0);font-family: inherit; font-size: inherit;\" class=\"has-inline-color has-purple-color\">import<\/mark><span style=\"background-color: initial; font-family: inherit; font-size: inherit; color: var(--wp--preset--color--text-primary);\"> org.apache.http.HttpHost;<\/span><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> org.elasticsearch.client.RestClient;\n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> org.elasticsearch.client.RestClientBuilder;<\/code>\n<span style=\"background-color: initial; font-family: inherit; font-size: inherit; color: var(--wp--preset--color--text-primary);\">RestClientBuilder restClientBuilder = RestClient.builder(HttpHost.create(\"aws.es.endPoint\")).setHttpClientConfigCallback(e -&gt;     <\/span>\n<span style=\"background-color: initial; font-family: inherit; font-size: inherit; color: var(--wp--preset--color--text-primary);\">e.addInterceptorLast(interceptor));<\/span>\n    \n<strong>Step 5: Perform Elasticsearch Operations:<\/strong>\n<strong>Once you have the client, you can perform various operations on your Elasticsearch cluster, such as indexing documents, searching, and more.<\/strong>\n    \n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">import<\/mark> org.elasticsearch.client.Response;\nResponse response = restClientBuilder.build().performRequest(request);\n\n<strong>Step 6 : You can upload your Lambda function jar on AWS<\/strong> <\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1344\" height=\"822\" src=\"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/java-blog-create-function.png\" alt=\"Once you have the client, you can perform various operations on your Elasticsearch cluster, such as indexing documents, searching, and more.\n\" class=\"wp-image-52\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"> <strong>Step 7 : Create API endpoint in API gateway for your Lambda function. We can also secure the API endpoint by   configuring APIs with API Key in API Gateway.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"790\" height=\"360\" src=\"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/java-blog-target-backend-1.png\" alt=\"Step 7 : Create API endpoint in API gateway for your Lambda function. We can also secure the API endpoint by configuring APIs with API Key in API Gateway.\" class=\"wp-image-53\" style=\"width:753px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You may also like :\u00a0<a href=\"https:\/\/www.200oksolutions.com\/blog\/javas-continued-dominance-in-enterprise-development\/\" target=\"_blank\" rel=\"noreferrer noopener\">Java\u2019s Continued Dominance in Enterprise Development<\/a><\/p>\n\n\n<div class=\"is-default-size wp-block-site-logo\"><a href=\"https:\/\/www.200oksolutions.com\/blog\/\" class=\"custom-logo-link light-mode-logo\" rel=\"home\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"191\" src=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/01\/cropped-200ok_logo.png\" class=\"custom-logo\" alt=\"200OK Solutions Blog\" srcset=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/01\/cropped-200ok_logo.png 484w, https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/01\/cropped-200ok_logo-300x118.png 300w\" sizes=\"(max-width: 484px) 100vw, 484px\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>AWS Lambda is a serverless computing service provided by Amazon Web Services (AWS). It allows&hellip;<\/p>\n","protected":false},"author":5,"featured_media":4589,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[2123,2125,1307,1880,705,2126,2124,1485,2127,706],"class_list":["post-48","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-amazon-opensearch","tag-api-gateway","tag-aws","tag-aws-api-gateway","tag-aws-lambda","tag-elasticsearch","tag-elasticsearch-java-client","tag-java","tag-rest-api","tag-serverless"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA<\/title>\n<meta name=\"description\" content=\"Learn how to build a serverless AWS Lambda API for Elasticsearch using Java and API Gateway. Follow this step-by-step guide with setup, dependencies, and AWS request signing.\" \/>\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.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA\" \/>\n<meta property=\"og:description\" content=\"Learn how to build a serverless AWS Lambda API for Elasticsearch using Java and API Gateway. Follow this step-by-step guide with setup, dependencies, and AWS request signing.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/\" \/>\n<meta property=\"og:site_name\" content=\"200OK Solutions Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-12T13:19:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-13T12:55:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2240\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Piyush Solanki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Piyush Solanki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/\"},\"author\":{\"name\":\"Piyush Solanki\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e\"},\"headline\":\"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA.\",\"datePublished\":\"2023-12-12T13:19:44+00:00\",\"dateModified\":\"2026-07-13T12:55:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/\"},\"wordCount\":299,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png\",\"keywords\":[\"Amazon OpenSearch\",\"API Gateway\",\"AWS\",\"AWS API Gateway\",\"AWS Lambda\",\"Elasticsearch\",\"Elasticsearch Java Client\",\"Java\",\"REST API\",\"Serverless\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#respond\"]}]},{\"@type\":[\"WebPage\",\"SearchResultsPage\"],\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\",\"name\":\"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA\",\"isPartOf\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png\",\"datePublished\":\"2023-12-12T13:19:44+00:00\",\"dateModified\":\"2026-07-13T12:55:19+00:00\",\"description\":\"Learn how to build a serverless AWS Lambda API for Elasticsearch using Java and API Gateway. Follow this step-by-step guide with setup, dependencies, and AWS request signing.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png\",\"contentUrl\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png\",\"width\":2240,\"height\":1260,\"caption\":\"Serverless Lambda-based REST APIs to connect Elasticsearch using Java with AWS Lambda, API Gateway, and Amazon OpenSearch by 200OK Solutions\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.200oksolutions.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Home > Blog >Java > Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#website\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/\",\"name\":\"Web Development, Software, and App Blog | 200OK Solutions\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.200oksolutions.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#organization\",\"name\":\"200OK Solutions\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png\",\"contentUrl\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png\",\"width\":500,\"height\":191,\"caption\":\"200OK Solutions\"},\"image\":{\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.instagram.com\/200ok_solutions\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e\",\"name\":\"Piyush Solanki\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/05\/cropped-piyush-solanki-96x96.jpg\",\"contentUrl\":\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/05\/cropped-piyush-solanki-96x96.jpg\",\"caption\":\"Piyush Solanki\"},\"description\":\"Piyush is a seasoned PHP Tech Lead with 10+ years of experience architecting and delivering scalable web and mobile backend solutions for global brands and fast-growing SMEs. He specializes in PHP, MySQL, CodeIgniter, WordPress, and custom API development, helping businesses modernize legacy systems and launch secure, high-performance digital products. He collaborates closely with mobile teams building Android &amp; iOS apps , developing RESTful APIs, cloud integrations, and secure payment systems using platforms like Stripe, AWS S3, and OTP\/SMS gateways. His work extends across CMS customization, microservices-ready backend architectures, and smooth product deployments across Linux and cloud-based environments. Piyush also has a strong understanding of modern front-end technologies such as React and TypeScript, enabling him to contribute to full-stack development workflows and advanced admin panels. With a successful delivery track record in the UK market and experience building digital products for sectors like finance, hospitality, retail, consulting, and food services, Piyush is passionate about helping SMEs scale technology teams, improve operational efficiency, and accelerate innovation through backend excellence and digital tools.\",\"url\":\"https:\/\/www.200oksolutions.com\/blog\/author\/piyush\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA","description":"Learn how to build a serverless AWS Lambda API for Elasticsearch using Java and API Gateway. Follow this step-by-step guide with setup, dependencies, and AWS request signing.","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.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/","og_locale":"en_US","og_type":"article","og_title":"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA","og_description":"Learn how to build a serverless AWS Lambda API for Elasticsearch using Java and API Gateway. Follow this step-by-step guide with setup, dependencies, and AWS request signing.","og_url":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/","og_site_name":"200OK Solutions Blog","article_published_time":"2023-12-12T13:19:44+00:00","article_modified_time":"2026-07-13T12:55:19+00:00","og_image":[{"width":2240,"height":1260,"url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png","type":"image\/png"}],"author":"Piyush Solanki","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Piyush Solanki","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#article","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/"},"author":{"name":"Piyush Solanki","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e"},"headline":"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA.","datePublished":"2023-12-12T13:19:44+00:00","dateModified":"2026-07-13T12:55:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/"},"wordCount":299,"commentCount":0,"publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage"},"thumbnailUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png","keywords":["Amazon OpenSearch","API Gateway","AWS","AWS API Gateway","AWS Lambda","Elasticsearch","Elasticsearch Java Client","Java","REST API","Serverless"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#respond"]}]},{"@type":["WebPage","SearchResultsPage"],"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java\/","url":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java","name":"Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage"},"thumbnailUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png","datePublished":"2023-12-12T13:19:44+00:00","dateModified":"2026-07-13T12:55:19+00:00","description":"Learn how to build a serverless AWS Lambda API for Elasticsearch using Java and API Gateway. Follow this step-by-step guide with setup, dependencies, and AWS request signing.","breadcrumb":{"@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#primaryimage","url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png","contentUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2023\/12\/How-to-Migrate-to-Cloud-Native-Architectures-Using-Microservices-1-40.png","width":2240,"height":1260,"caption":"Serverless Lambda-based REST APIs to connect Elasticsearch using Java with AWS Lambda, API Gateway, and Amazon OpenSearch by 200OK Solutions"},{"@type":"BreadcrumbList","@id":"https:\/\/www.200oksolutions.com\/blog\/serverless-lambda-based-rest-apis-to-connect-to-elastic-search-using-java#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.200oksolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Home > Blog >Java > Serverless Lambda-based REST APIs To Connect to Elastic Search Using JAVA."}]},{"@type":"WebSite","@id":"https:\/\/www.200oksolutions.com\/blog\/#website","url":"https:\/\/www.200oksolutions.com\/blog\/","name":"Web Development, Software, and App Blog | 200OK Solutions","description":"","publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.200oksolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.200oksolutions.com\/blog\/#organization","name":"200OK Solutions","url":"https:\/\/www.200oksolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","contentUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","width":500,"height":191,"caption":"200OK Solutions"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.instagram.com\/200ok_solutions\/"]},{"@type":"Person","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e","name":"Piyush Solanki","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/05\/cropped-piyush-solanki-96x96.jpg","contentUrl":"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/05\/cropped-piyush-solanki-96x96.jpg","caption":"Piyush Solanki"},"description":"Piyush is a seasoned PHP Tech Lead with 10+ years of experience architecting and delivering scalable web and mobile backend solutions for global brands and fast-growing SMEs. He specializes in PHP, MySQL, CodeIgniter, WordPress, and custom API development, helping businesses modernize legacy systems and launch secure, high-performance digital products. He collaborates closely with mobile teams building Android &amp; iOS apps , developing RESTful APIs, cloud integrations, and secure payment systems using platforms like Stripe, AWS S3, and OTP\/SMS gateways. His work extends across CMS customization, microservices-ready backend architectures, and smooth product deployments across Linux and cloud-based environments. Piyush also has a strong understanding of modern front-end technologies such as React and TypeScript, enabling him to contribute to full-stack development workflows and advanced admin panels. With a successful delivery track record in the UK market and experience building digital products for sectors like finance, hospitality, retail, consulting, and food services, Piyush is passionate about helping SMEs scale technology teams, improve operational efficiency, and accelerate innovation through backend excellence and digital tools.","url":"https:\/\/www.200oksolutions.com\/blog\/author\/piyush\/"}]}},"_links":{"self":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/48","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":32,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"predecessor-version":[{"id":4590,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/48\/revisions\/4590"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media\/4589"}],"wp:attachment":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}