define index

define index

Define an index that can be used when executing queries. Then, you can execute a single command to create multiple indexes all at once using create defined indexes.

Availability: Online or offline.

define index --name=value --expression=value --region=value [--type=value]
Table 1. Parameters
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
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