title: Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it
body: <p>Currently, Getting result based on scoring but what i want to do is i want a result based on <strong>scoring + Field Status with value true/false.</strong> </p>
  
  <p>If value is true then needed that results in priority but there is <strong>possibility that status field is not exist</strong> in all indices.</p>
  
  <pre><code>           "query" =&gt; [
                    'bool' =&gt; [
                       'filter' =&gt; $filter,
                       'must' =&gt; [
                       "multi_match" =&gt; [
                          'query' =&gt; "$string",
                          "type" =&gt; "cross_fields",
                          'fields' =&gt; ['field1','field2','field3'],
                          "minimum_should_match" =&gt; "80%"
                           ]
                      ]
                    ]
              ],
              "sort" =&gt; [
                      "_score",
                      [ "status" =&gt; ["order" =&gt; "desc","unmapped_type" =&gt; "boolean"] ]
              ],
  </code></pre>
  
  <p>But getting error below :</p>
  
  <pre><code>[type] =&gt; illegal_argument_exception
  [reason] =&gt; Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [status] in order to load field data by uninverting the inverted index. Note that this can use significant memory.
  </code></pre>
  
  <p>Anyone help me out to ignore for indices where that field not available or any other solution with this problem?</p>