# How to get the relevance matching using java API?

**URL:** https://discuss.elastic.co/t/how-to-get-the-relevance-matching-using-java-api/4925
**Category:** Elasticsearch
**Created:** [July 22, 2011, 7:46am UTC](https://discuss.elastic.co/t/how-to-get-the-relevance-matching-using-java-api/4925 "2011-07-22T07:46:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)
#### Post date: [July 22, 2011, 7:46am UTC](https://discuss.elastic.co/t/how-to-get-the-relevance-matching-using-java-api/4925/1 "2011-07-22T07:46:11Z")

</div>

Hi,

I'm searching my data in the index, I want to get that most relevance  
matched data from index.for example i'm searching data "abcd" and my  
inex contain "a","ab", "abc" ,then most relevence matching is "abc"  
for search data. My requirement is that if more than one hit is found  
then i have to select the most relevance data.  
please tell me which java API and it's method will help me to get this  
type of searching.

Thanks

---

<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: [July 6, 2017, 3:59am UTC](https://discuss.elastic.co/t/how-to-get-the-relevance-matching-using-java-api/4925/2 "2017-07-06T03:59:49Z")

</div>


