ES Json ingestion to ES and request validation in ES

Hello Team,
I have a scenario to work with ES + java spring boot
1.i have to ingest a json to file to ES driver ? is it possible. ?
2. I have a request field ,f how can i validate the my request to json fields which has been ingested already to ES, is there is any possibilities ?
could you share any releated stuff

Your help will be appreciated.!!

Thanks
vinay

i have to ingest a json to file to ES driver ? is it possible. ?

Do you mean that you have a JSON file, that you want to read it from disk and send its content to Elasticsearch? Do you mean something else?
But in general, the answer is yes. You can send a JSON content to elasticsearch using the Rest Client.

I have a request field ,f how can i validate the my request to json fields which has been ingested already to ES, is there is any possibilities ?

I don't understand the question.

1 Like

let say, i have a json file in ES Disk , now i have few validations to be performed by reading json using java +ES .
is it possible.
could you please share some notes

What kind of validations? Any concrete example of documents you want to read and the validations you want to have?

yes. exactly same

After validating those field should be sent to ES to retrieve data .

for loading data disc what are possible ways using java client

yes. exactly same

After validating those field should be sent to ES to retrieve data .

for loading data disc what are possible ways using java client

Could you answer my questions?

  • What are the validations you want to run?
  • Can you share one sample document?

Sure..

lets say i have request

{ "name":"A",
"id":"11",
"location":"india"
}

i have a json file in ES like below
{
{"name_value":name",
"id_val":"id",
"location_val":"location"}

{ "name_value":name",
"id_val":"id",
"location_val":"state"
}
{ "name_value":idnetity",
"id_val":"id",
"location_val":"state"
}
}

here i have 3 jsons json array..based on input i need to check which is valid json and the i need to retrive those tag

I don't understand sorry.
So I'm going to answer to your initial question.

i have to ingest a json to file to ES driver ? is it possible. ?

Yes. have a look at Index API | Java REST Client [7.17] | Elastic

IndexRequest request = new IndexRequest("posts"); 
request.id("1"); 
String jsonString = "{" +
        "\"user\":\"kimchy\"," +
        "\"postDate\":\"2013-01-30\"," +
        "\"message\":\"trying out Elasticsearch\"" +
        "}";
request.source(jsonString, XContentType.JSON);
IndexResponse indexResponse = client.index(request, RequestOptions.DEFAULT);

Then you're done with ingesting a document in elasticsearch.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.