Multiple document handling

Hello,

I'm trying to use the index action, and I'm trying to save the multiple documents returned by my search.
For that I use the transform feature and I'm attempting to return the multiple document like this:

"index_payload" : { 
    "transform": {
      "script" : "return [_doc : ctx.payload.hits.hits]"
      },
    
    "index" : {
      "index" : "test_index", 
      "doc_type" : "array" 
    }
  }

This doesn't work and I'm getting the following error:

{
      "id": "index_payload",
      "type": "index",
      "status": "failure",
      "reason": "NullPointerException[null]"
    }

Any ideas?

Hey,

a couple of follow up question to narrow down your problem

  1. What is the Elasticsearch version you are using?
  2. Is there any additional output in the master node log file?
  3. Does your search contain hits?
  4. Can you paste the output of the execute watch API here?
  5. Are you sure you want to index each element of the hits array as own document and not the _source field inside of each hit?

--Alex

Hello,
Thanks for your reply. Here are the details:

  1. ElasticSearch version: 2.4.1 (Elastic Cloud)
  2. Not sure I have access to that file...
  3. Yes, the search does contain hits
  4. Execute watch output:

https://docs.google.com/a/zinaria.com/document/d/1ikhfCVazvgP_Rru8d620zzI0OwQ-eDFH0cBvoNqWG0E/edit?usp=sharing

  1. I think the _source field of each hits would be ideal.

Thanks!

Hey,

I dont have access to that google doc, can you please use something, that can handle text easier, like a pastebin or a gist?

--Alex

Sorry, there you go:
https://gist.github.com/diopib/28a6ebe4837b3c15915c4dc2849787f6
Thanks

Hey,

ok this does not yield anything useful either. If you are on cloud, can you please use the "Logs" console of your cluster and search for exceptions there?

Also, can you provide the full watch somewhere, so I can try to reproduce?

--Alex