Relevance of results on multiple fields

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:

{
    "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.

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