Structured search returns only a limited set of attributes

101 Views Asked by At

A couple of questions about OCI structured search, using the Python SDK.

# Create a search client
  search_client=oci.resource_search.ResourceSearchClient(config)
  # Create a structured search query
  query_string=("query instance resources where displayName =~ 'mike'")
  structured_search = oci.resource_search.models.StructuredSearchDetails(query=query_string,type='Structured')
  # Search for matching instances                                                             
  instances = search_client.search_resources(structured_search)
  for i in instances.data.items:
    print([i.display_name,i.lifecycle_state])
    # i.shape does not return anything

Question 1: How can I return the shape for my instances? The structured search results return a sub-set of the attributes returned by list_instances(), for example. The shape attribute is not returned.

Question 2: defined_tags is returned by the structured search. But how can I match the defined_tags.Oracle-Tags.CreatedBy attribute? I have been trying something like this, with no luck:

query_string=("query instance resources where ((definedTags.oracleTags.key='CreatedBy') && (definedTags.oracleTags.value=~'mike'))")
0

There are 0 best solutions below