Filter on script hit result

Hi all and sorry for my poor english.
I'm filtering my index cpes using script (painless).
As a a result , I have hits with null values and I need to exclude those hits.
I've done this query, but I cannot find a way to excludes null hits

GET cpes/_search
{
  "script_fields": {
    "cpeBox_with_profiles_grather_than_1": {
      "script": {
        "lang": "painless",
        "source": "if (params['_source'].profiles.size()>10) return params['_source'].cpeBoxId; "
      }
    }
  }  
}

Result is

{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12654213",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12651607",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12386833",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12647464",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12649048",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12651604",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12657472",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12654692",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12659253",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      },
      {
        "_index" : "cpes",
        "_type" : "_doc",
        "_id" : "12660748",
        "_score" : 1.0,
        "fields" : {
          "cpeBox_with_profiles_grather_than_1" : [
            null
          ]
        }
      }
    ]
  }
}

What I need is to exclude hits with cpeBox_with_profiles_grather_than_1= null

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