elasticsearch 理解GET /_index_template/< template name>和GET _cat/templates之间的区别?v输出

krcsximq  于 2023-10-17  发布在  ElasticSearch
关注(0)|答案(1)|浏览(188)

在elastic _cat/templates中?v输出,我看到两个模板:

  1. "1": {
  2. "name": "flowlogtmplt",
  3. "index_patterns": "[flowlog*, flowobsrv*]",
  4. "order": "0",
  5. "version": null,
  6. "composed_of": ""
  7. },
  8. "14": {
  9. "name": "flowlog",
  10. "index_patterns": "[flowlog-*]",
  11. "order": "0",
  12. "version": null,
  13. "composed_of": "[]"
  14. },

然而,当我尝试使用GET /_index_template/检查模板名称时,只有“flowlog”返回结果,但“flowlogtmplt”返回404错误。为什么弹性不承认“flowlogtmplt”作为索引模板?

GET /_index_template/flowlog

  1. {
  2. "index_templates": [
  3. {
  4. "name": "flowlog",
  5. "index_template": {
  6. "index_patterns": [
  7. "flowlog-*"
  8. ],
  9. "template": {
  10. "settings": {
  11. "index": {
  12. "lifecycle": {
  13. "name": "flowlog"
  14. }
  15. }
  16. }
  17. },
  18. "composed_of": []
  19. }
  20. }
  21. ]
  22. }

GET /_index_template/flowlogtmplt

  1. {
  2. "error": {
  3. "root_cause": [
  4. {
  5. "type": "resource_not_found_exception",
  6. "reason": "index template matching [flowlogtmplt] not found"
  7. }
  8. ],
  9. "type": "resource_not_found_exception",
  10. "reason": "index template matching [flowlogtmplt] not found"
  11. },
  12. "status": 404
  13. }

这与my prior question here有关。

nqwrtyyt

nqwrtyyt1#

GET _cat/templates返回

所以你应该试试这个

  1. GET _template/flowlogtmplt

相关问题