opensearch-java icon indicating copy to clipboard operation
opensearch-java copied to clipboard

[BUG] exception with deserializing 'type' key of analyzer object

Open kdh6429 opened this issue 11 months ago • 2 comments

What is the bug?

If the index does not have anlayzer's type key, deserialization will fail with an JsonParsingException. Failed to fetch indices from jakarta.json.stream.JsonParsingException: Property 'type' not found

How can one reproduce the bug?

Request an index created with the settings below using GetIndexRequest

{
   "settings":{
      "index":{
         "number_of_shards":"2",
         "number_of_replicas":"0",
         "analysis":{
            "analyzer":{
               "keyword_analyzer":{
                  "filter":["lowercase"],
                  "tokenizer":"keyword"
                  // << ---------------------type key is missing 
              }
            }
         }
      }
   },
   "mappings":{
      "properties":{
         "title":{
            "type":"keyword"
         }
      }
   }
}

What is the expected behavior?

If there is no type key value in analyzer, treat it as a 'custom' value

What is your host/environment?

opensearch version: 1.3.8 opensearch-java version: 2.5.0 Java version: 17 Apple M1 Pro

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

Cannot change or add type to analyzer of already created index

kdh6429 avatar Jul 16 '23 04:07 kdh6429