# Comparing multiple fields with multiple expected values

**URL:** <https://discuss.elastic.co/t/comparing-multiple-fields-with-multiple-expected-values/160094>\
**Category:** Elasticsearch\
**Created:** [December 10, 2018, 5:05am UTC](https://discuss.elastic.co/t/comparing-multiple-fields-with-multiple-expected-values/160094 "2018-12-10T05:05:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MMostafa\_elastic](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@MMostafa\_elastic](https://discuss.elastic.co/u/MMostafa_elastic)\
**Post date:** [December 10, 2018, 5:05am UTC](https://discuss.elastic.co/t/comparing-multiple-fields-with-multiple-expected-values/160094/1 "2018-12-10T05:05:11Z")

</div>

I am building a search function and would like to know the best approach to implement the following scenario:

- I am using multiple text fields say x1,x2,x3,x4.
- All fields may contain value or be empty.
- In case there is a value I need to apply matching using fuzziness to get all possible documents that matches the inputs.
- In case of empty values in x2 or x3, the document considered as matching and should be returned in the result.
- Preferred to be using Java API  
Best regards

---

<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:** [January 7, 2019, 5:05am UTC](https://discuss.elastic.co/t/comparing-multiple-fields-with-multiple-expected-values/160094/2 "2019-01-07T05:05:27Z")

</div>

Closed on January 7, 2019, 5:05am UTC

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