Skip to content

Add a boolean field hidden in the Issue ES mapping

Ravi Kumar requested to merge 341448-add-hidden-field-issue-es-schema into master

What does this MR do and why?

This MR will add a boolean field hidden in the Issue ES mapping. The value of hidden will be true if the author of the issue is banned and the value will be false if the author of the issue is unbanned. This field can be used to filter out the hidden issues in the search results

Screenshots or screen recordings

Screenshot_2023-02-28_at_09.29.00

How to set up and validate locally

  1. Run local development with elasticsearch and sidekiq running
gdk start
  1. Run the elasticsearch migration
gitlab:elastic:index
  1. Run the ES _search query and make sure the hidden attribute is present
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-issues/_search' | json_pp
  1. Now ban an author of an issue, and run the _search query again. Set the author_id to the banned user_id.
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-issues/_search' -d '{ "query": { "term": { "author_id":  47 } } }' | json_pp
  1. Make sure the hidden attribute value is true. You might have to wait for a few seconds to finish the reindexing
  2. Now unban the user and run the same query
curl -H 'Content-type: application/json' -XGET 'http://localhost:9200/gitlab-development-issues/_search' -d '{ "query": { "term": { "author_id":  47 } } }' | json_pp
  1. Make sure the hidden attribute value is false. You might have to wait for few seconds to finish the reindexing

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #341448 (closed)

Edited by Ravi Kumar

Merge request reports