# Get the matched and unmatched result based on fields inside an index

**URL:** <https://discuss.elastic.co/t/get-the-matched-and-unmatched-result-based-on-fields-inside-an-index/326397>\
**Category:** Elasticsearch\
**Created:** [February 24, 2023, 4:06am UTC](https://discuss.elastic.co/t/get-the-matched-and-unmatched-result-based-on-fields-inside-an-index/326397 "2023-02-24T04:06:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashant\_Pandey1](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Prashant\_Pandey1](https://discuss.elastic.co/u/Prashant_Pandey1)\
**Post date:** [February 24, 2023, 4:06am UTC](https://discuss.elastic.co/t/get-the-matched-and-unmatched-result-based-on-fields-inside-an-index/326397/1 "2023-02-24T04:06:21Z")

</div>

Hi All , I'm new to Elasticsearch, please can someone help on this  
I want to matched and unmatched data based on fields from index.  
Sample of Data Schema of index :

{  
"\_index": "comparebyid",  
"\_id": "MPGsra40AGzOIw1d4LlG5dkAAAAAAAAA",  
"\_score": 1,  
"\_source": {  
"compare": "match",  
"Document": [  
{  
"doc": {  
"clientName": "Domino's",  
"phone": "7787888888",  
"dOB": "",  
"id": "005c023e-dee9-402a-8841-f892855ecf3e",  
"typeData": "Zero\_Data",  
"email": "[Dom@kc.com](mailto:Dom@kc.com)"  
}  
},  
{  
"doc": {  
"id": "005c023e-dee9-402a-8841-f892855ecf3e",  
"typeData": "KC\_App",  
"clientName": "Domino's",  
"dOB": ""  
}  
}  
]  
}  
},  
{  
"\_index": "comparebyid",  
"\_id": "MNRSJju9ye\_dP5Xyj6Hagc0AAAAAAAAA",  
"\_score": 1,  
"\_source": {  
"compare": "match",  
"Document": [  
{  
"doc": {  
"id": "0085b9d3-d711-4230-9bce-f1466a509959",  
"typeData": "KC\_App",  
"clientName": "Royal J",  
"dOB": ""  
}  
},  
{  
"doc": {  
"clientName": "Royal J",  
"phone": "7412369859",  
"dOB": "",  
"id": "0085b9d3-d711-4230-9bce-f1466a509959",  
"typeData": "Zero\_Data",  
"email": "[royal@gmail.com](mailto:royal@gmail.com)"  
}  
}  
]  
}  
}..................

So I want to the matched and unmatched result based on 'email ' and 'dob' fields in case of "compare": "mismatch".

Like this :  
Document.doc[0].email = Document.doc[1].email Document.doc[0].dob= Document.doc[1].dob =\>atlease min 50 % match then =\>\>  
it will give 'matched', otherwise 'mismatch'

I hope , my question is cleared, if not please let me know.  
I will be eagerly waiting for response.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 24, 2023, 4:06am UTC](https://discuss.elastic.co/t/get-the-matched-and-unmatched-result-based-on-fields-inside-an-index/326397/2 "2023-03-24T04:06:35Z")

</div>

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