Scalar retrieval (Java SDK V2)
This topic describes how to perform scalar retrieval by using MetaQuery in OSS Java SDK V2.
How it works
Scalar retrieval is an indexing feature provided by OSS that is based on object metadata. You can define query conditions to quickly filter and obtain the list of objects that meet the conditions, sort the results by specified fields, and perform aggregation on the results.
Prerequisites
OSS Java SDK V2 is installed. If you use Maven, add the following dependency to the pom.xml file:
com.aliyun:alibabacloud-oss-v2.Access credentials are configured by using environment variables. The examples in this topic use
EnvironmentVariableCredentialsProviderto read credentials from theOSS_ACCESS_KEY_IDandOSS_ACCESS_KEY_SECRETenvironment variables.
Permissions
By default, an Alibaba Cloud account has full permissions. RAM users and RAM roles have no permissions by default. The Alibaba Cloud account owner or an administrator must grant the required permissions.
API | Actions | Description |
OpenMetaQuery |
| Enables metadata management. |
GetMetaQueryStatus |
| Obtains metadata index information. |
DoMetaQuery |
| Queries objects that meet specified conditions. |
CloseMetaQuery |
| Disables metadata management. |
Sample code
References
For API details about enabling metadata management, see OpenMetaQuery.
For API details about obtaining metadata index information, see GetMetaQueryStatus.
For API details about querying objects that meet conditions, see DoMetaQuery.
For API details about disabling metadata management, see CloseMetaQuery.
For the synchronous sample code, see OpenMetaQuery.java.
For the synchronous sample code, see DoMetaQuery.java.
For the synchronous sample code, see CloseMetaQuery.java.