# Relevance of results on multiple fields

**URL:** <https://discuss.elastic.co/t/relevance-of-results-on-multiple-fields/318245>\
**Category:** Elasticsearch\
**Created:** [November 5, 2022, 6:55pm UTC](https://discuss.elastic.co/t/relevance-of-results-on-multiple-fields/318245 "2022-11-05T18:55:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChristopherHS](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@ChristopherHS](https://discuss.elastic.co/u/ChristopherHS)\
**Post date:** [November 5, 2022, 6:55pm UTC](https://discuss.elastic.co/t/relevance-of-results-on-multiple-fields/318245/1 "2022-11-05T18:55:20Z")

</div>

Hello,

We are new to the use of Elasticsearch, we can't make a setting to display the results with the right relevance on the phrase in the search.

To give an example, when we do a search with the phrase `Facebook Data Api`, all the videos that contain `Facebook Data Api` in the `title` come up and this is what we are looking for:

- Facebook Data API Python
- Facebook Data API PHP
- Connects to Facebook Data API  
...

But when we do a search for the phrase `Facebook data api PHP`, we have results that go back like:

- Facebook Data API PHP
- PHP Mysql Data API
- Facebook Data API Python
- Youtube Data API PHP
- Connects to Facebook Data API  
...

We would first like to have the results that correspond to the beginning of the searched phrase `Facebook data api...` and to have a result like:

- Facebook Data API PHP
- Facebook Data API Python
- Connects to Facebook Data API
- PHP Mysql Data API
- Youtube Data API PHP

Here is the query used:

```json
{
    "size": 40,
    "from": 0,
    "query": {
        "bool": {
            "must": [
                {
                    "query_string": {
                        "query": "Facebook Data Api PHP",
                        "fields": [
                            "title",
                            "categories.name",
                            "producer.name",
                            "actors.name",
                            "tags.name"
                        ]
                    }
                }
            ],
            "should": [
                {
                    "match_phrase": {
                        "title": "Facebook Data Api PHP"
                    }
                },
                {
                    "match_phrase": {
                        "_translations": "Facebook Data Api PHP"
                    }
                },
                {
                    "match_phrase": {
                        "categories.name": "Facebook Data Api PHP"
                    }
                },
                {
                    "match_phrase": {
                        "producer.name": "Facebook Data Api PHP"
                    }
                },
                {
                    "match_phrase": {
                        "actors.name": "Facebook Data Api PHP"
                    }
                },
                {
                    "match_phrase": {
                        "tags.name": "Facebook Data Api PHP"
                    }
                }
            ],
            "filter": [
                {
                    "bool": {
                        "must": [
                            {
                                "term": {
                                    "segment": 1
                                }
                            }
                        ]
                    }
                }
            ]
        }
    }
}

```

Thanks for your help.

---

<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:** [December 3, 2022, 6:55pm UTC](https://discuss.elastic.co/t/relevance-of-results-on-multiple-fields/318245/2 "2022-12-03T18:55:32Z")

</div>

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