# No field found for \[\] in mapping with types \[\]

**URL:** <https://discuss.elastic.co/t/no-field-found-for-in-mapping-with-types/250668>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [October 1, 2020, 12:07pm UTC](https://discuss.elastic.co/t/no-field-found-for-in-mapping-with-types/250668 "2020-10-01T12:07:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shobin-ebp](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@shobin-ebp](https://discuss.elastic.co/u/shobin-ebp)\
**Post date:** [October 1, 2020, 12:07pm UTC](https://discuss.elastic.co/t/no-field-found-for-in-mapping-with-types/250668/1 "2020-10-01T12:07:32Z")

</div>

I have following query

```auto
{
  "query": {
    "function_score": {
      "query": {
        "match_all": {}
      },
      "functions": [
        {
          "script_score": {
            "script": {
              "lang": "painless",
              "source": """
              if (doc['likedBy'].length>0) { return 1;} else {return 0;}"""
            }
          },
          "weight": 100
        }
      ]
    }
  }
}

```

Where likedBy is nested field and contains values like

```auto
 [
            {
              "userId" : "5f50928d4d1395228e5c1c42",
              "updatedTime" : 1599183429,
              "_id" : "5f519a454439702cd42ab2de"
            },
            {
              "userId" : "5f6ecae581a21f046aaa8d5a",
              "updatedTime" : 1601098376,
              "_id" : "5f6ed28881a21f046aaa8de9"
            }
]

```

and `[]` for empty . But above query shows error saying No field found for [likedBy] in mapping with types `[]`

---

<div class="post-metadata">

**Author:** ![Juan\_Cruz\_Rojas\_Pin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_cruz_rojas_pin/32/77567_2.png) [@Juan\_Cruz\_Rojas\_Pin](https://discuss.elastic.co/u/Juan_Cruz_Rojas_Pin)\
**Post date:** [October 21, 2020, 12:08am UTC](https://discuss.elastic.co/t/no-field-found-for-in-mapping-with-types/250668/2 "2020-10-21T00:08:39Z")

</div>

hi, I have the same problem. were you able to fix it?

---

<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:** [November 18, 2020, 12:08am UTC](https://discuss.elastic.co/t/no-field-found-for-in-mapping-with-types/250668/3 "2020-11-18T00:08:44Z")

</div>

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