This topic describes the define command in gfsh, the VMware Tanzu GemFire command-line interface.

Use this command to define an index that can be used when executing queries. This allows you to execute a single command to create multiple indexes concurrently using create defined indexes.

Availability: Online or offline.


define index --name=value --expression=value --region=value [--type=value]

Name Description Default Value
‑‑name Required. Name of the index to define.  
‑‑expression Required. Field of the region values that are referenced by the index.  
‑‑region Required. Name/Path of the region which corresponds to the “from” clause in a query.  
‑‑type Type of the index. Valid values are: range, key and hash. range

Table 1. Define Index Parameters

Example Commands:

gfsh> define index --name=myIndex1 --expression=exp1 --region=/exampleRegion 

gfsh> define index --name=myIndex2 --expression="c.exp2" --region="/exampleRegion e, e.collection1 c" 

gfsh> define index --name=myIndex3 --expression=exp3 --region=/exampleRegion --type=hash 

//then to create the indexes, execute:

gfsh> create defined indexes

Sample Output:

gfsh>define index --name=myIndex1 --expression=exp1 --region=/exampleRegion
Index successfully defined with following details
Name       : myIndex1
Expression : exp1
RegionPath : /exampleRegion
check-circle-line exclamation-circle-line close-line
Scroll to top icon