Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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()
)
Posted
Updated 21-Oct-22 23:25pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900