Required parameters: resource-type and search-param.
POST /rpcmethod:aidbox.index/suggest-indexparams:resource-type:<resourceType>search-param:<searchParameter>
Example:
POST /rpcmethod:aidbox.index/suggest-indexparams:resource-type:Observationsearch-param:date
Result:
result: - index-name:observation_date_param_knife_date_min_tstzname:dateresource-type:Observationstatement:>- CREATE INDEX CONCURRENTLY IF NOT EXISTS "observation_date_param_knife_date_min_tstz" ON "observation" USING btree ((knife_extract_min_timestamptz("observation".resource, '[["effective","Period","start"],["effective","Period","end"],["effective","dateTime"],["effective","Timing","event"],["effective","instant"]]')) )subtypes: - null - eq - ne - lt - le - btwtype:date - index-name:observation_date_param_knife_date_max_tstzname:dateresource-type:Observationstatement:>- CREATE INDEX CONCURRENTLY IF NOT EXISTS "observation_date_param_knife_date_max_tstz" ON "observation" USING btree ((knife_extract_max_timestamptz("observation".resource, '[["effective","Period","start"],["effective","Period","end"],["effective","dateTime"],["effective","Timing","event"],["effective","instant"]]')) )subtypes: - null - eq - ne - gt - ge - btwtype:date
Suggested two indexes: first one to search using lt, le and eq prefixes, second one to search usinggt, ge, eq prefixes.
aidbox.index/suggest-index-query
You can get all indexes for specific query using suggest-index-query.
Required parameters: resource-type and query.
POST /rpcmethod:aidbox.index/suggest-index-queryparams:resource-type:<resourceType>query:<query>
Example:
POST /rpcmethod:aidbox.index/suggest-index-queryparams:resource-type:Observationquery:date=gt2022-01-01&_id=myid
Response:
result: - index-name:observation_date_param_knife_date_min_tstzname:dateresource-type:Observationstatement:>- CREATE INDEX CONCURRENTLY IF NOT EXISTS "observation_date_param_knife_date_min_tstz" ON "observation" USING btree ((knife_extract_min_timestamptz("observation".resource, '[["effective","Period","start"],["effective","Period","end"],["effective","dateTime"],["effective","Timing","event"],["effective","instant"]]')) )subtypes: - null - eq - ne - lt - le - btwtype:date - index-name:observation_date_param_knife_date_max_tstzname:dateresource-type:Observationstatement:>- CREATE INDEX CONCURRENTLY IF NOT EXISTS "observation_date_param_knife_date_max_tstz" ON "observation" USING btree ((knife_extract_max_timestamptz("observation".resource, '[["effective","Period","start"],["effective","Period","end"],["effective","dateTime"],["effective","Timing","event"],["effective","instant"]]')) )subtypes: - null - eq - ne - gt - ge - btwtype:date - index-name:observation_resource_idname:idresource-type:Observationstatement:>- CREATE INDEX CONCURRENTLY IF NOT EXISTS "observation_resource_id" ON "observation" USING btree (("observation".id) )subtypes: - in - nulltype:id
Suggested indexes will increase performance of Observation.date and Observation._id.