Deleted tags keep showing after running ES query
When some content has a tag that eventually is deleted from Tags portlet, this deleted tag keeps showing in the search results when you run an ES query. In addition, when you go to Edit the same content that had the tag, you can see the tag is still showing unless you flush all caches from Maintenance portlet.
Expected Behavior
Once the tag is delete, ES should not display the tag in the search results. In addition, that deleted tag should not show up when you go to the Edit the content that had the tag previously.
Current Behavior
After the tag is deleted rom Tags portlet, this deleted tag keeps showing in the search results when you run an ES query. In addition, when you go to Edit the same content that had the tag, you can see the tag is still showing unless you flush all caches from Maintenance portlet.
Steps to Reproduce (for bugs)
- Login to dotcms
- Navigate to Dev Tools> ES Search
- Run the following query
{
"query": {
"query_string": {
"query": "+contenttype:news"
}
},
"aggs" : {
"tag" : {
"terms" : {
"field": "tags",
"size" : 20
}
}
},
"size":0
}
- You may see something like this:

- Choose one of the tags displayed in the list (i.e."debt") and delete it directly by going to Types & Tags> Tags portlet
- Run again the same ES query on step 3. You will see the tag is still showing in the list.
- In addition, if you look for those contents that had the tag before it was deleted, you can see that those contents still show the tag even when now it's been deleted, for example:
{
"query": {
"bool": {
"must": [
{
"term": {
"news.tags": "debt"
}
}
]
}
}
}
-
Search results:

-
Content still shows deleted tag

Your Environment
- dotCMS version used: master branch / reproduced also in http://demo.dotcms.com
- Database and version: Postgres 9.6.6
- Operating System and version: Mac OS 10.10.5
- Browser Name and version: Firefox v58.0
- Application Server and version: Tomcat 8
- Java Brand and version: Java 8
Solved in https://github.com/dotCMS/core/issues/13872
Passed QA. System is not showing deleted tags after running ES query. Tested on master branch / Postgres 9.6.6 / Mac OS 10.10.5 / Firefox v58.0 / Tomcat 8 / Java 8