Skip to content

Implement search in namespace context

Pavel Barzou requested to merge #89-inplement-search-in-namespace-context into master

Implemented search in custom namespaces with x-collaboration header. The code is feature flagged with collaborations-enabled flag

curl --location 'localhost:8092/api/search/v2/query' \
--header 'Content-Type: application/json' \
--header 'data-partition-id: osdu' \
--header 'x-collaboration: id=96d5550e-2b5e-4b84-825c-646339ee5fc7,application=pws' \
--header 'Authorization: ••••••' \
--data '{
	"kind":"osdu:search1717500302132:test-data--Integration:1.0.6"
}

When we send request with x-collaboration will be add part to request to ElasticSearch:


        "bool": {
            "must": [{
                "bool": {
                    "must": [{
                        "bool": {
                            "must": [{
                                "exists": {
                                    "field": "x-collaboration"
                                }
                            },{
                                "term": {
                                    "x-collaboration": "id=96d5550e-2b5e-4b84-825c-646339ee5fc7,application=pws"
                                }
                            }]
                        }
                    }]
                }
            }]
        }

If we will send request without x-collaboration header:

curl --location 'localhost:8092/api/search/v2/query' \
--header 'Content-Type: application/json' \
--header 'data-partition-id: osdu' \
--header 'Authorization: ••••••' \
--data '{
	"kind": "osdu:wks:master-data--CollaborationProject:1.0.0",
    "query": "id:\"osdu:master-data--CollaborationProject:275f1abfc7c44f35b5173e7c987638e8\""
}

To request will be added:


    "bool": {
      "must_not": {
        "exists": {
          "field": "x-collaboration"
        }
      }
    }

Type of change

  • Bug Fix
  • Feature

Please provide link to gitlab issue or ADR(Architecture Decision Record)

Does this introduce a change in the core logic?

  • [YES]

Does this introduce a change in the cloud provider implementation, if so which cloud?

  • AWS
  • Azure
  • Google Cloud
  • IBM

Does this introduce a breaking change?

  • [NO]

What is the current behavior?

We can't searching in different custom namespaces

What is the new/expected behavior?

We can searching in different custom namespaces

Have you added/updated Unit Tests and Integration Tests?

Added Unit and Integration tests

Any other useful information

Link to task

Link to ADR

Before merging this MR we should merge MRs with constants before, according to comment !653 (comment 316947)

Edited by Pavel Barzou

Merge request reports

Loading