# Help me for mapping & query

**URL:** <https://discuss.elastic.co/t/help-me-for-mapping-query/35790>\
**Category:** Elasticsearch\
**Created:** [November 27, 2015, 10:01pm UTC](https://discuss.elastic.co/t/help-me-for-mapping-query/35790 "2015-11-27T22:01:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrashidi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrashidi/32/6230_2.png) [@mrashidi](https://discuss.elastic.co/u/mrashidi)\
**Post date:** [November 27, 2015, 10:01pm UTC](https://discuss.elastic.co/t/help-me-for-mapping-query/35790/1 "2015-11-27T22:01:16Z")

</div>

I have this mapping & query. everything is working, except when i want to filter those contents with mentioned "tagid"s. it returns zero results.

```
    {
  "mappings": {
    "video": {
      "_all": {
        "enabled": true
      },
      "properties": {
        "title": {
          "type": "string"
        },
        "en_title": {
          "type": "string"
        },
        "tags": {
          "type": "nested",
          "properties": {
            "tagname": {
              "type": "string"
            },
            "tagid": {
              "type": "string",
              "index": "not_analyzed"
            }
          }
        },
        "metadescription": {
          "type": "string"
        },
        "author": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "items": {
          "type": "nested",
          "properties": {
            "item_title": {
              "type": "string"
            },
            "item_duration": {
              "type": "string",
              "index": "not_analyzed"
            }
          }
        },
        "isfeatured": {
          "type": "string",
          "index": "not_analyzed"
        },
        "image": {
          "type": "string",
          "index": "not_analyzed"
        },
        "contenttype": {
          "type": "string",
          "index": "not_analyzed"
        },
        "category": {
          "type": "string",
          "index": "not_analyzed"
        },
        "categoryalias": {
          "type": "string",
          "index": "not_analyzed"
        },
        "url": {
          "type": "string",
          "index": "not_analyzed"
        },
        "authorid": {
          "type": "string",
          "index": "not_analyzed"
        },
        "price": {
          "type": "string",
          "index": "not_analyzed"
        },
        "duration": {
          "type": "string",
          "index": "not_analyzed"
        },
        "publishdate": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        }
      }
    }
  }
}

```

and this is the query:

```
    {
  "index": "content",
  "type": "video",
  "body": {
    "query": {
      "filtered": {
        "query": {
          "match_all": { }
        },
        "filter": {
          "bool": {
            "must": [
              {
                "nested": {
                  "path": "tags",
                  "query": {
                    "bool": {
                      "should": [
                        {
                          "term": {
                            "tagid": "193"
                          }
                        },
                        {
                          "term": {
                            "tagid": "194"
                          }
                        }
                      ]
                    }
                  }
                }
              },
              {
                "term": {
                  "categoryalias": "digilife"
                }
              },
              {
                "term": {
                  "price": 0
                }
              }
            ]
          }
        }
      }
    },
    "from": 0,
    "size": 9,
    "sort": [
      "_score"
    ]
  }
}
```

---

<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 5, 2017, 11:35pm UTC](https://discuss.elastic.co/t/help-me-for-mapping-query/35790/2 "2017-07-05T23:35:17Z")

</div>


