# Logstash giving error while creating template - Failed to install template Got response code '400' contacting Elasticsearch at URL

**URL:** <https://discuss.elastic.co/t/logstash-giving-error-while-creating-template-failed-to-install-template-got-response-code-400-contacting-elasticsearch-at-url/307677>\
**Category:** Logstash\
**Created:** [June 20, 2022, 3:14pm UTC](https://discuss.elastic.co/t/logstash-giving-error-while-creating-template-failed-to-install-template-got-response-code-400-contacting-elasticsearch-at-url/307677 "2022-06-20T15:14:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anand\_tripathi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anand_tripathi/32/107286_2.png) [@anand\_tripathi](https://discuss.elastic.co/u/anand_tripathi)\
**Post date:** [June 20, 2022, 3:14pm UTC](https://discuss.elastic.co/t/logstash-giving-error-while-creating-template-failed-to-install-template-got-response-code-400-contacting-elasticsearch-at-url/307677/1 "2022-06-20T15:14:10Z")

</div>

I am getting this error failed to install when specifying the template file in the logstash configuration. But the same template json is working if I create it using the Elasticsearch API. I actually don't want to create it using Elasticsearch

So basically I want to create the template using logstash and it should apply the specified template for the input data while inserting records in the Elasticsearch

Below is my logstash code

```auto
elasticsearch {
      hosts => "elasticsearch:9200"
      index => "family"
      document_type => "type"
      user => ""
      password => ""
      document_id => "%{family_id}"
      doc_as_upsert => true
      action => "update"
      manage_template => true
      template => "/usr/share/logstash/mappings/family.json"
      template_name => "family_template"
      template_overwrite => true
    }

```

And below is my template

```auto
{
  "index_patterns": ["family*"],
  "version": 1,
  "settings": {
    "number_of_shards": 3,
    "index.refresh_interval" : "60s"
  },
  "mappings": {
    "dynamic": false,
    "properties": {
      "@timestamp": {
        "type": "date"
      },
      "@version": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "family_id": {
        "type": "long"
      },
      "members": {
        "type": "nested",
        "properties": {
          "abstract": {
            "properties": {
              "abstract": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "lang": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "applicant": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "application_dt": {
            "type": "date"
          },
          "assignee": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "citation": {
            "type": "nested",
            "properties": {
              "family_id": {
                "type": "long"
              },
              "ucid": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "claims": {
            "properties": {
              "claim": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "lang": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "country": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "cpc_code": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "family_id": {
            "type": "long"
          },
          "ifi_patent_status": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "invention_title": {
            "properties": {
              "lang": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "title": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "inventor": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "is_design": {
            "type": "boolean"
          },
          "lang": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "priority_dt": {
            "type": "date"
          },
          "produced": {
            "type": "date"
          },
          "publication_id": {
            "type": "long"
          },
          "published": {
            "type": "date"
          },
          "score": {
            "type": "float"
          },
          "standardized_assignee": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "ucid": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      },
      "predicted_data": {
        "type": "nested",
        "properties": {
          "confidence_score": {
            "type": "float"
          },
          "modified_dt": {
            "type": "date"
          },
          "query_id": {
            "type": "long"
          }
        }
      },
      "representative": {
        "properties": {
          "abstract": {
            "properties": {
              "abstract": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "lang": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "applicant": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "application_dt": {
            "type": "date"
          },
          "assignee": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "citation": {
            "type": "nested",
            "properties": {
              "family_id": {
                "type": "long"
              },
              "ucid": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "claims": {
            "properties": {
              "claim": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "lang": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "country": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "cpc_code": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "family_id": {
            "type": "long"
          },
          "ifi_patent_status": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "invention_title": {
            "properties": {
              "lang": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              },
              "title": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword",
                    "ignore_above": 256
                  }
                }
              }
            }
          },
          "inventor": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "is_design": {
            "type": "boolean"
          },
          "lang": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "priority_dt": {
            "type": "date"
          },
          "produced": {
            "type": "date"
          },
          "publication_id": {
            "type": "long"
          },
          "published": {
            "type": "date"
          },
          "score": {
            "type": "float"
          },
          "standardized_assignee": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "ucid": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2022, 3:14pm UTC](https://discuss.elastic.co/t/logstash-giving-error-while-creating-template-failed-to-install-template-got-response-code-400-contacting-elasticsearch-at-url/307677/2 "2022-07-18T15:14:19Z")

</div>

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