Create a file with name tablestoreConf.json
in ${user.home}
(For windows: C:\Documents and Settings\%username%\tablestoreCong.json
, for linux /home/${username}/tablestoreCong.json
, for mac /Users/${username}/tablestoreCong.json
)
{
"endpoint": "*****",
"accessId": "*******",
"accessKey": "*************",
"instanceName": "*****"
}
Tablestore java sdk.
<dependency>
<groupId>com.aliyun.openservices</groupId>
<artifactId>tablestore</artifactId>
<version>4.12.0</version>
</dependency>
JSON parsing tool for parsing config and jsonizing java bean.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
Help tools for manipulating String, Number, etc.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
</dependency>
.
└── java
└── com
└── aliyun
└── tablestore
└── example
├── BaseExample.java # Example base class
├── CleanupEnv.java # Cleanup environment
├── FuzzySearchExample.java # Create table & index, mock data, fuzzy search :)
├── consts
│ └── ColumnConsts.java # Column names
├── model
│ └── OrderDO.java # Domain object
└── utils
├── ClientAndConfig.java # TableStore related config
└── Utils.java # Common Utils
Run the main method in class FuzzySearchExample
, the table & index would be created, mock data inserted, along with several fuzzy search examples.
query consumer's cell number by prefix
query consumer's cell number by wildcard
query product name using SingleWord analyzer
query product type using Fuzzy analyzer
Run the main method in class CleanupEnv
{
"endpoint": "*****",
"accessId": "*******",
"accessKey": "*************",
"instanceName": "*****",
"table": "another_table_name",
"index": "another_index_name"
}