Skip to main content

search lucene

search lucene

Search a Lucene index

See also create lucene index, describe lucene index, destroy lucene index and list lucene indexes.

Availability: Online.

Syntax:

search lucene --name=value --region=value --queryString=value --defaultField=value
[--limit=value] [--keys-only=value]

Parameters, search lucene:

NameDescriptionDefault Value
--nameRequired. Name of the Lucene index to search.
--regionRequired. Name/Path of the region where the Lucene index exists.
--queryStringRequired. Query string to search the Lucene index. Use __REGION_VALUE_FIELD as the field name when the field is a primitive value. Surround a string with double quotes to perform an exact match.
--defaultFieldRequired. Default field to search in. __REGION_VALUE_FIELD identifies the field as a primitive value.
--limitNumber of search results to return.If not specified: -1
--keys-onlyReturn only the keys of search results.If not specified: false

Example Commands:

gfsh> search lucene --name=testIndex --region=/testRegion --queryString=value1
--defaultField=__REGION_VALUE_FIELD


gfsh> search lucene --name=indexOfStrings --region=/stringTestRegion
--queryString='__REGION_VALUE_FIELD:"my exact string"'
--defaultField=__REGION_VALUE_FIELD

Sample Output:

gfsh>search lucene --name=testIndex --region=/testRegion --queryString=value*
--defaultField=__REGION_VALUE_FIELD
key | value | score
--- | ------ | -----
3 | value3 | 1
2 | value2 | 1
1 | value1 | 1
gfsh>search lucene --region=/Person --name=analyzerIndex
--defaultField=addr --queryString="97763"
key | value | score
------ | ------------------------------------------------------------------ | --------
key763 | Person{name='Kris Cat', addr='7 Ash St, Portland_OR_97763', emai.. | 1.669657