Make text based fields filterable
Currently the OpenSearch index stores text fields like license and type in a way that's optimized for searching but not for filtering/aggregating.
Searching: "Find documents containing the word 'MIT'" → works great Filtering: "Show me all unique license values and count how many times each appears" → doesn't work
Why? When OpenSearch stores a text field with value "MIT License", it: Breaks it into tokens: ["mit", "license"] Lowercases and analyzes them Stores them in a way that's great for search but useless for exact grouping To filter/aggregate, you need the exact original value "MIT License" stored separately.
Possible Solution Add a .keyword subfield to your text fields. This stores BOTH versions: license (text) → for searching: "mit", "license" license.keyword (keyword) → for filtering: "MIT License" (exact value)