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

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

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

{
  "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
              }
            }
          }
        }
      }
    }
  }
}
2 Likes

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