There are three ways to utilize Elasticsearch via Clowder:
- Using the /api/search endpoint
- Using Search box in the upper right of Clowder
- Going to Explore > Advanced Search
We want to make sure there is consistency in behavior across these methods as much as possible.
/api/search
- documented in Swagger
- automatically handles spaces in phrases via parsing request string
- ?query=
- supports some regular expressions e.g. .*
- ?resource_type=file|dataset|collection
- ?field=
- metadata field name, "metadata." prefix not required
- ?datasetid= ?collectionid= ?tag=
- example parsing:
- http://localhost:9000/clowder/api/search?field=Alternative Title&query=foo bar
Searching Elasticsearch: {"bool":{"must":[{"regexp":{"metadata.Alternative Title":"foo bar"}}]}}
/search (via Search box)
- poorly documented
- by default, searches _all indexed fields
- id, name, creator, parent_of, child_of, description, tags, comments, metadata
- _all will not delve into nested objects by default, so useless for metadata unless user specifies a field as shown below
- general idea was to support basic : notation for being more specific
- for nested objects like metadata, metadata.fieldname notation is required
- example queries:
- banana
- "baby carrots"
- metadata.Favorite Fruit:banana
- metadata.Favorite Snack:"baby carrots"
- metadata.Favorite Fruit:banana metadata.Favorite Snack:"baby carrots"
- should we support this kind of notation? to what extent?
- would be nice if the same features were available to both API and search box
/metadata/search (a.k.a. Advanced Search)
- easier to use visually
- limited to metadata fields
- supports space filtering