title: Elastic Search - sort on should and must
body: <p>I have this problem, i want to sort on 2 match, and my code look like this right now (its in php array)</p>
  
  <pre><code>$data = [
      'query' =&gt; [
          'bool' =&gt; [
              'must' =&gt; [
                  'multi_match' =&gt; [
                      'query' =&gt; $q,
                      'fields' =&gt; ['Fulltext'],
                      'type' =&gt; 'cross_fields',
                      'operator' =&gt; 'and'
                  ]
              ],
              'should' =&gt; [
                  'match' =&gt; [
                      'Title' =&gt; $q,
                  ]
              ]
          ]
      ],
      'aggregations' =&gt; [
          'categorys' =&gt; [
              'terms' =&gt; [
                  'field' =&gt; 'Categorys.value',
                  'size' =&gt; $category_size
              ]
          ]
      ],
      'size' =&gt; $product_size,
      'sort' =&gt; [
          'Popular' =&gt; [
              'order' =&gt; 'desc'
          ]
      ]
  ];
  </code></pre>
  
  <p>The problem in this sort i want to sort it by "Popular" but, its not first sort on match in "should" and then after in "must" so my question is.</p>
  
  <p>How can i start sorting in the first match points, and then sort in the secound match points based on Popular field?</p>
  
  <p>The problem is i want to search in prouct where the query match in Title is higher importen then in Fulltext field.</p>
  
  <p>so if i get 10 resualt based on Title and the score are highter then the next 10 resualt based on Fulltext, but we have 3 reusalt from Title and 2 from Fulltext where Probular is gretnder then 0 then this match shut be view'en and sorted by (_score, Popular) if Popular is greather then zero else sort just based on (_score)</p>
  
  <p>Can eny body help me with this question?</p>