Split a document into several documents


(Rym Guerbi Michaut) #1

Hi there,

I have a single document loaded in elasticsearch and I'd like to split it into several documents on the "user" field.

I've tried doing it with Logstash filters but it didn't work.

The document contains a lot of nested objects and looks like this:

{
  "user": [
    {
      "week": {
        "type": "nested",
        "timespent": {"type": "float"},
        "timespentinterne": {"type": "float"},
        "percentintern": {"type": "text"},
        "worklogs": {
			"type": "nested",
			"KFIT2K18-16": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-15": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-14": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-13": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-12": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-11": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-10": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-9": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-8": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-7": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-6": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-5": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-4": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-3": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-2": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}},
			"KFIT2K18-1": {
				"type": "nested","worklogsdetails": [ {"type": "nested","timespent": "float","commentairewl": "text","authorKey": "keyword","issueKey": "text","datewl": "float","dateReadablewl": "date"}],"TimespentOnIssue": {"type": "float"}
          }
        }
      }
    }
  ]
}

Could anyone help please?


(system) #2

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