elasticsearch-grails-plugin
elasticsearch-grails-plugin copied to clipboard
Properties mapping of string fields to ES type keyword not working as expected
Expected Behavior
Class Test {
String name
static searchable = {
name index: "true"
}
}
The above code's mapped ES type should be keyword. But the code maps to text.
Actual Behaviour
The above code maps to type text.
Steps To Reproduce
No response
Environment Information
- JDK 8
Example Application
No response
Version
4
The issue seems to be in the below code found in SearchableClassPropertyMapping
boolean isAnalyzed() {
String index = (String) mappingAttributes.index
(index == null || index)
}
The below table shows how the code works.
| property | value | value | value |
|---|---|---|---|
| index | "true" | "false" | null |
| isAnalyzed | true | true | true |
| ES type | "text" | "text" | "text" |
The code should work like below.
| property | value | value | value |
|---|---|---|---|
| index | "true" | "false" | null |
| isAnalyzed | false | true | true |
| ES type | "keyword" | "text" | "text" |