Apply analyzer on Object fields


(lea) #1

Hello!

I have this analyzer:

{
  "index": {
    "number_of_shards": 1,
    "analysis": {
      "filter": {
        "word_joiner": {
          "type": "word_delimiter",
          "catenate_all": true,
          "preserve_original": true
        }
      },
      "analyzer": {
        "word_join_analyzer": {
          "type": "custom",
          "filter": [
            "word_joiner"
          ],
          "tokenizer": "keyword"
        }
      }
    }
  }
}

I apply it on this field:

@Field(type = FieldType.Object, analyzer = "word_join_analyzer")
private Description description;

And here is the Description class:

public class Description {

       @JsonProperty("localizedDescriptions")
       private Map<String, String> descriptions = new HashMap<>();
}

This is the resulting Elasticsearch mapping for this field:

{  
   "description":{  
      "properties":{  
         "localizedDescriptions":{  
            "properties":{  
               "en":{  
                  "type":"string"
               },
               "fr":{  
                  "type":"string"
               },
               "it":{  
                  "type":"string"
               }
            }
         }
      }
   }
}

Like you can see, the anlyzer is not applied at all. It works well with string fields, but I have a hard time doing it with Object types. Any ideas?
Thanks!


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.