Here is the code of Indexing a single Document User(uid, firstName, lastName, email, address, phoneNumber) into index(firstindex), but actually the problem is that the index created successfully but document not inserted:
val user = User("1","abc", "def", "abc123@gmail.com", "ab", 1234)
val indexReqBuilder= new IndexRequest.Builder[User]
indexReqBuilder.index("firstindex")
indexReqBuilder.document(user)
indexReqBuilder.id(user.Uid)
What I have tried:
Here is the code of making client:
val restClient: RestClient = RestClient.builder(
new HttpHost("localhost", 9200)).build();
val transport: ElasticsearchTransport = new RestClientTransport(restClient, new JacksonJsonpMapper)
val esAsyncClient: ElasticsearchAsyncClient = new ElasticsearchAsyncClient(transport)
Here is the code of creating Index (firstindex)
val createResponse = esAsyncClient.indices().create(
new CreateIndexRequest.Builder()
.index("firstindex")
.build()
)