# Wildcard queries on multiple fields and filtering by score

**URL:** https://discuss.elastic.co/t/wildcard-queries-on-multiple-fields-and-filtering-by-score/247079
**Category:** Elasticsearch
**Created:** [September 1, 2020, 11:22am UTC](https://discuss.elastic.co/t/wildcard-queries-on-multiple-fields-and-filtering-by-score/247079 "2020-09-01T11:22:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![zamkinos](https://avatars.discourse-cdn.com/v4/letter/z/9d8465/32.png) [@zamkinos](https://discuss.elastic.co/u/zamkinos)
#### Post date: [September 1, 2020, 11:22am UTC](https://discuss.elastic.co/t/wildcard-queries-on-multiple-fields-and-filtering-by-score/247079/1 "2020-09-01T11:22:31Z")

</div>

I have an index like below:

 ![Image 12](https://us1.discourse-cdn.com/elastic/original/3X/1/6/16166eb51b92776036eb89402216d75a0ed33f99.jpeg)

For example user searchs "c 001", I look at search\_all\_fields and find it in two documents.  
With WildCardQuery for all searching keywords " _c_ " and " _001_ "  
But the second one is useless. Because the first one matches with search\_item\_no. This is more valuable. The second one matches with search\_group\_one field. This is less valuable. I must filter it.

But on the other hand, someone searchs "yyy 102", then it only takes place in search\_group\_one and search\_group two field. So I must not filter it.

Going twice elastic side for scoring is expensive. But How can I achive this?

I asked this before. [Filter Based On Average Score](https://discuss.elastic.co/t/filter-based-on-average-score/239429)  
I've added the scenarios and index structure.

Any advice would be appreciated.

---

<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: [September 29, 2020, 11:22am UTC](https://discuss.elastic.co/t/wildcard-queries-on-multiple-fields-and-filtering-by-score/247079/2 "2020-09-29T11:22:40Z")

</div>

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