OpenSearch-Dashboards icon indicating copy to clipboard operation
OpenSearch-Dashboards copied to clipboard

[Workspace] Fix workspace name duplication check

Open Hailong-am opened this issue 9 months ago • 3 comments

Description

enclose workspace name with double quotes when doing duplication check, so that it will not interpret by simply query syntax and do match it with exact match (workspace.name field type is keyword)

GET .kibana/_search
{
  "profile": "true", 
  "query": {
    "simple_query_string": {
      "query": "\"demo workspace\"",
      "fields": ["workspace.name"]
    }
  }
}

It will convert to TermQuery that's exact match.

  "profile": {
    "shards": [
      {
        "id": "[qYfwnwnoTiqalgsnAT9rjA][.kibana_12][0]",
        "inbound_network_time_in_millis": 0,
        "outbound_network_time_in_millis": 0,
        "searches": [
          {
            "query": [
              {
                "type": "TermQuery",
                "description": "workspace.name:demo workspace",
                "time_in_nanos": 9585,
                "breakdown": {
                  ...
                }
              }
            ]
           ...
          }
        ],
        "aggregations": []
      }
    ]
  }

Issues Resolved

https://github.com/opensearch-project/OpenSearch-Dashboards/issues/6480

Screenshot

Testing the changes

Changelog

  • fix: fix workspace name duplication check

Check List

  • [x] All tests pass
    • [x] yarn test:jest
    • [x] yarn test:jest_integration
  • [x] New functionality includes testing. ~~- [ ] New functionality has been documented.~~
  • [x] Update CHANGELOG.md
  • [x] Commits are signed per the DCO using --signoff

Hailong-am avatar May 13 '24 03:05 Hailong-am