Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
AWS managed OpenSearch Serverless
Describe the issue:
First time posting here so apologies if I am doing it at the wrong place
I’m trying to create a new index for a OpenSearch cluster that is AWS managed serverless. The new index has a custom analyzer and tokenizer. When I create this new index via Terraform, the index did get created, but AWS didn’t pick up any of the analyzer/tokenizer information. This is my opensearch_index
resource in Terraform
resource "opensearch_index" "index_name" {
name = "name"
depends_on = [aws_opensearchserverless_collection.collection_name, aws_iam_user_policy_attachment.attachment_name]
analysis_tokenizer = jsonencode({
"tokenizer_name" : {
"type" : "pattern",
"pattern" : "\\."
}
})
analysis_analyzer = jsonencode({
"analyzer_name" : {
"tokenizer" : "tokenizer_name",
"filter" : [
"lowercase"
]
}
})
}
I tried creating the index directly via OpenSearch API with the same config and it worked. This is the PUT request I used
PUT index-name
{
"settings": {
"analysis": {
"tokenizer": {
"tokenizer-name": {
"type": "pattern",
"pattern": "\\."
}
},
"analyzer": {
"analyzer-name": {
"type": "custom",
"tokenizer": "tokenizer-name",
"filter": [
"lowercase"
]
}
}
}
}
}
Has anyone successfully created an index with analyzer and tokenizer via Terraform? If yes, what is the shape of JSON string you use for analysis_tokenizer
and analysis_analyzer
? Thank you.
Configuration:
Relevant Logs or Screenshots: