from cognite.client.data_classes.data_modeling import ViewId
res = client.data_modeling.instances.search(
ViewId("mySpace", "PersonView", "v1"),
query="Arnold",
properties=["name"])
from cognite.client.data_classes.data_modeling import ViewId
from cognite.client.data_classes import filters
born_after_1970 = filters.Range(["mySpace", "PersonView/v1", "birthYear"], gt=1970)
res = client.data_modeling.instances.search(
ViewId("mySpace", "PersonView", "v1"),
query="Quentin",
properties=["name"],
filter=born_after_1970){
"items": [
{
"instanceType": "node",
"version": 123,
"space": "<string>",
"externalId": "<string>",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"type": {
"space": "<string>",
"externalId": "<string>"
},
"deletedTime": 1730204346000,
"properties": {}
}
],
"typing": {}
}Required capabilities:
DataModels:READ
Search text fields in views for nodes or edge(s). The service will return up to 1000 results. This operation orders the results by relevance, across the specified spaces.
from cognite.client.data_classes.data_modeling import ViewId
res = client.data_modeling.instances.search(
ViewId("mySpace", "PersonView", "v1"),
query="Arnold",
properties=["name"])
from cognite.client.data_classes.data_modeling import ViewId
from cognite.client.data_classes import filters
born_after_1970 = filters.Range(["mySpace", "PersonView/v1", "birthYear"], gt=1970)
res = client.data_modeling.instances.search(
ViewId("mySpace", "PersonView", "v1"),
query="Quentin",
properties=["name"],
filter=born_after_1970){
"items": [
{
"instanceType": "node",
"version": 123,
"space": "<string>",
"externalId": "<string>",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"type": {
"space": "<string>",
"externalId": "<string>"
},
"deletedTime": 1730204346000,
"properties": {}
}
],
"typing": {}
}Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
The search specification.
Searching nodes or edges using properties from a view
Reference to a view
Show child attributes
Query string that will be parsed and used for search.
Limit the search query to searching nodes or edges. Unless you set the item type to apply the search to, the service will default to searching nodes within the view.
node, edge Optional array of properties you want to search through. If you do not specify one or more properties, the service will search all text fields within the view.
Properties to convert to another unit. The API can only convert to another unit, if a unit has been defined as part of the type on the underlying container being queried.
1 - 10 elementsShow child attributes
Build a new query by combining other queries, using boolean operators. We support the and, or, and
not boolean operators.
Show child attributes
{
"and": [
{
"in": {
"property": ["tag"],
"values": [10011, 10011]
}
},
{
"range": { "property": ["weight"], "gte": 0 }
}
]
}Should we return property type information as part of the result?
5Show child attributes
Controls how multiple search terms are combined when matching documents.
OR (default): A document matches if it contains any of the query terms in the searchable fields. This typically returns more results but with lower precision.
AND: A document matches only if it contains all of the query terms across the searchable fields. This typically returns fewer results but with higher relevance.
AND, OR Limits the number of results to return.
1 <= x <= 1000Was this page helpful?