How to check if a Field from a JSON Data exists in the Index bevor send another Data with same Field to Elasticsearch

Hello Folks,
i have this JSON Data in Elastic , and i want to check in mytest Index , if it contains the application_id=6 , so i can avoid sending the same JSON DATA twice with the same application_id=6 .
Is there any Function in Java like example "check_exists_content_field" to check wheather the Field application_id=6 existis in the Index "mytest" ???
i am using REST ClientAPI in Java version 8.0 , and Elasticsearch Version 6.3.1.

"hits": {
"total": 1,
"max_score": 1,
"hits": [
"_index": "mytest",
"_type": "_doc",
"_id": "1",
"_score": 1,
"_source": {
"entity": {
"birthday_id": 0,
"application_id": 6,
"mission": [
"element 1"
"element 2"
"process": {
"login_id": 1311,
"page_name": "update"
"text": "hello world"

I just found how to check the Indexname , but not the field "application_id=6" inside the Index.

boolean checkIndexExist = client.admin().indices()    
                    .prepareExists("hier mytest indexname as example")

i tried to create request , and assign it with the indexname "mytest" above, and asked it to return the field "application_id" like in this page

GetFieldMappingsRequest request1 = new GetFieldMappingsRequest();
request1.fields("entity", "application_id");
GetFieldMappingsResponse response = client.admin().indices()
                        .getFieldMapping(request1, RequestOptions.DEFAULT);

i cound not finde the RequestOptions Class.
Otherwise at the end of the Page is written `

final Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetaData>> mappings =

and that did not work until i changed it to 

final Map<String, Map<String, Map<String, GetFieldMappingsResponse.FieldMappingMetaData>>> mappings
                        = response.mappings();

Please any Idea how to check the field "application_id=6" as Request bevor letting my ClientAPI send the same Data with the same field twice , i will be thankfull.

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