# Sorting based on boost factor

**URL:** <https://discuss.elastic.co/t/sorting-based-on-boost-factor/7837>\
**Category:** Elasticsearch\
**Created:** [May 24, 2012, 8:48am UTC](https://discuss.elastic.co/t/sorting-based-on-boost-factor/7837 "2012-05-24T08:48:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SG1](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@SG1](https://discuss.elastic.co/u/SG1)\
**Post date:** [May 24, 2012, 8:48am UTC](https://discuss.elastic.co/t/sorting-based-on-boost-factor/7837/1 "2012-05-24T08:48:21Z")

</div>

Hi,

I have created a search collection with the below boost factor:

{"content\_collection"=\>{"album"=\>{"properties"=\>{"title"=\>{"type"=\>"string"},  
"track\_titles"=\>{"boost"=\>2.0, "type"=\>"string"},  
"artists\_names"=\>{"boost"=\>3.0, "type"=\>"string"}}}}}

Tried to search using :  
curl '[http://localhost:9200/content\_collection/album/\_search](http://localhost:9200/content_collection/album/_search)' -d '  
{  
"query" : {  
"dis\_max" : {  
"queries" : [  
{  
"field" : { "artists\_names" : { "query" : " Tetsu  
utitled club", "boost" : 3.0}}  
},  
{  
"field" : { "track\_titles" : { "query" : "Tetsu  
untitled club", "boost" : 2.0}}  
},  
{  
"field" : { "title" : { "query" : "Tetsu untitled  
club", "boost" : 1.0}}  
}  
]  
}  
}  
}  
'  
Requirement is that the search result should order according to the  
boost factor. If the search text is brain: Then it should search for  
all the three fields with the search string and should respond with  
the order of boost.  
So the records which matches with the artist\_names should appear first  
followed by the records which matches against the track\_titles and  
title. But it is coming in some other sequence and not considering the  
boost factor.

Thanks!

---

<div class="post-metadata">

**Author:** ![SG1](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@SG1](https://discuss.elastic.co/u/SG1)\
**Post date:** [May 24, 2012, 10:37am UTC](https://discuss.elastic.co/t/sorting-based-on-boost-factor/7837/2 "2012-05-24T10:37:48Z")

</div>

I have accomplished with the following search:  
curl '[http://localhost:9200/content\_collection/album/\_search](http://localhost:9200/content_collection/album/_search)' -d '  
{  
"query" : {  
"dis\_max" : {  
"queries" : [  
{  
"constant\_score" : {  
"query" : {  
"text" : { "artists\_names" : "Tetsu untitled club"}  
},  
"boost" : 3.0  
}  
},  
{  
"constant\_score" : {  
"query" : {  
"text" : { "track\_titles" : "Tetsu untitled club"}  
},  
"boost" : 2.0  
}

```
        },
        {
          "constant_score" : {
            "query" : {
              "text" : { "title" : "Tetsu untitled club"}
              },
             "boost" : 1.0
          }

        }
    ]
}

```

}  
}

Please provide me the better solution if the given solution is not the exact one.

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:27am UTC](https://discuss.elastic.co/t/sorting-based-on-boost-factor/7837/3 "2017-07-06T03:27:17Z")

</div>


