I have an index that defines multiple collections of stringFacet
. For an example, let’s say we have the following index:
{
"mappings": {
"dynamic": false,
"fields": {
"colorsOfTheRainbow": {
"type": "stringFacet"
}
}
}
}
How would one construct a query to get all of the documents that have colorOfTheRainbow === 'red'
, for example?
I tried using a regular text operator, but that didn’t yield any results. A comparable query against this definition would look like this:
$search: {
index: 'arbitrary',
text: {
path: 'colorsOfTheRainbow',
query: 'red'
}
}
The workaround that I haven’t tried, but suspect will work would be to index the value twice, once as a stringFacet
and once as a string
with the lucene.keyword
analyzer.
Is this the expected approach?