Cannot PUT _index_template/template_1

This is already merged to develop. I’m waiting for the pipeline and I’m going to paste here links to a prebuild for ES versions mentioned in this thread. If anyone wants to test it, but didn’t let us know yet, let don’t hesitate to do it now (obviously, please give an info about ES version)

@kkt2mail ROR 1.28.0-pre5 for ES 7.9.0

@askids ROR 1.28.0-pre5 for ES 7.8.1

@bquartier ROR 1.28.0-pre5 for ES 7.9.2

@lenny ROR 1.28.0-pre5 for ES 7.10.1

And: ROR 1.28.0-pre5 for ES 7.11.1

I’d be grateful if you guys could test it and let me know if it works for you.

Hello,

I tested the new plugin and it is ok to add an index_template :

curl -X PUT "https://my-elasticsearch/_index_template/template_1?pretty" -H 'Content-Type: application/json' -d'
{
  "index_patterns" : ["test*"],
  "priority" : 1,
  "template": {
    "settings" : {
      ......
    }
  }
}'

{
  "acknowledged" : true
}

Thanks.

For information we use component templates on our platform and is seems its not working with the plugin :

curl -X PUT "https://my-elasticsearch/_index_template/template_1?pretty" -H 'Content-Type: application/json' -d'
{
  "index_patterns": ["test*"],
  "composed_of": ["component_1"]
}'

{
  "error" : {
    "root_cause" : [
      {
        "type" : "null_pointer_exception",
        "reason" : "Cannot invoke \"org.elasticsearch.cluster.metadata.Template.aliases()\" because the return value of \"org.elasticsearch.cluster.metadata.ComposableIndexTemplate.template()\" is null"
      }
    ],
  "status" : 500
}

(the same request bypassing the Readonlyrest plugin works great)

Regards,

Thanks for the info. We will check that. The component templates are supported, so it looks like a bug.

Could you please test this version?

If it fixes the issue you reported, we’ll release 1.28.1 with the bug fix as fast as possible.

Hello,

I tested the new version :

curl "https://es-cluster/_cat/plugins"                                                                                                       
es-master-2 readonlyrest  1.28.1-pre1

But I still have the same error :

curl -X PUT "https://es-master-2:9200/_index_template/testror?pretty" -H 'Content-Type: application/json' -d'
{
  "index_patterns": ["testror*"],
  "composed_of": ["component_1"]
}
'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "null_pointer_exception",
        "reason" : "Cannot invoke \"org.elasticsearch.cluster.metadata.Template.aliases()\" because the return value of \"org.elasticsearch.cluster.metadata.ComposableIndexTemplate.template()\" is null"
      }
    ],
    "type" : "null_pointer_exception",
    "reason" : "Cannot invoke \"org.elasticsearch.cluster.metadata.Template.aliases()\" because the return value of \"org.elasticsearch.cluster.metadata.ComposableIndexTemplate.template()\" is null"
  },
  "status" : 500
}

(Also tested with the terraform provider)

Here is the stacktrace in the master logs when th API call is done :
master_stacktrace.zip (1.8 KB)

Regards.

@lenny thanks for the stacktrace. Now it was easy to identify place where NPE occurred. Here is a build with fix: click

BTW. we have found 2 more issues with templates. They will be fixed soon. We’ll release 1.28.1 as soon as possible (at the beginning of the next week)

@lenny did you check the build? We’re about to release 1.28.1 and if it still doesn’t work in your case, please let us know.

I just tested the 1.28.1-pre3 version, everything works great !

I’ll wait for the 1.28.1 then, thanks !

Regards.

2 Likes