Difference Between Factory Method And Abstract Factory Design Patterns In Simple Terms

Here I will explain the difference between Factory Method & Abstract Factory design patterns. If you want to know about difference between Simple Factory & Factory Method, you can check my previous post. Factory Method: As explained in previous post, Factory Method can be used when same standard process or set of business rules needs … Read more

Simple Explanation On Difference Between Simple Factory And Factory Method Design Patterns

Here I will explain the difference between Simple Factory & Factory Method design patterns. There are two things: Simple Factory: Simple Factory is not an official design pattern. It is more of a design principle that you should follow as part of Object Oriented design. One should code to interface, not to concrete implementation. That … Read more

Solving security_exception while connecting to OpenSearch Serverless using Java SDK

Problem: We have a container pod running with a IAM role that has OpenSearch Serverless read/write data access on both collection items & indexes. Java application running within the container tries to access OpenSearch Serverless using standard opensearch-java & AWS Java sdks.But problem is that the Java client call to OpenSearch Serverless is failing with … Read more

How to Find Size of a Redis Key Value

Before we find out size of a Redis key & its value, let me clarify few things. In Redis, we can store data in two places. Redis stores data differently in memory & disk. While storing in RAM, there will be additional overhead for in-memory data structures that Redis use for fast data access. On … Read more

How to Enable External Version Support for OpenSearch Update Request

OpenSearch doesn’t support external versioning in Update request as of now. If you use HTTP command similar to below, you will get exception mentioned there. index1/_update/1?version=123&version_type=external { “doc”: {“title”: “updated title”}, } Validation Failed: 1: internal versioning can not be used for optimistic concurrency control. Please use if_seq_no and if_primary_term instead seq_no: Counter which gets … Read more

How to do Upsert Operation in OpenSearch

We will learn how to do upsert operation in OpenSearch. There are couple of ways to do it, one using Index operation & another using Update operation. But how they work is different. So we will have to choose carefully based on our use case. Upsert using Index operation: Index operation by default does upsert. … Read more

How to Write OpenSearch Bulk Operation Using Java SDK

Here we will learn the basic code to do bulk operation in OpenSearch using Java SDK. We will need below dependencies in our Gradle project. This is part of build.gradle file. implementation ‘org.opensearch.client:opensearch-rest-client: 2.3.0’ implementation ‘org.opensearch.client:opensearch-java:2.0.0’ For maven projects, we need to add the dependencies in pom.xml file. As we know, OpenSearch provides bulk operation … Read more