Q:

How to generate N FlowFiles and set the content of each FlowFile according to the data in Elastic? 

In Elasticsearch I have this index and mapping:
PUT /myindex
{
  "mappings": {
    "myentries": {
      "_all": {
        "enabled": false
      }, 
      "properties": {
          "yid": {"type": "keyword"},
          "days": { 
              "properties": {
                        "Type1":  { "type": "date" },
                        "Type2":  { "type": "date" }
              }
            },
            "directions": { 
              "properties": {
                      "name": {"type": "keyword"},
                      "recorder":  { "type": "keyword" },
                      "direction":  { "type": "integer" }
              }
            }
        }
    }
  }
}

I want to generate N FlowFiles, 1 for each combination of values of recorder and direction in the mapping directions.  How can I do it in Nifi?  I was thinking to use GenerateFlowFile, but how can I apply this logic related to Elasticsearch? 
One possible workaround might be to generate N FlowFiles using GenerateFlowFile, where Batch field could be hardcoded and set to 10 (the number of entries in Elastic).  But then I don't know what should be the next step? 

A:

GenerateFlowFile is probably not the right tool here, as it doesn't accept incoming connections, so you would not be able to parameterize it with the count.  You can use SplitJson, which will split the flowfile into multiple flowfiles given a JSONPath expression that returns an array from the JSON content.   
Update
Here is a great tool you can use to evaluate JSONPath dynamically and see what it matches.  In your example, let's say you received data like the following:
{
  "yid": "nifi",
  "days" : [{"Type1": "09/07/2017"},{"Type2":"10/07/2017"}],
  "directions": [
    {
        "name": "San Francisco",
      "recorder"  : "Samsung",
      "direction": "0"
    },
    {
        "name": "Santa Monica",
      "recorder"  : "iPhone",
      "direction": "270"
    },
    {
        "name": "San Diego",
      "recorder"  : "Razr",
      "direction": "180"
    },
    {
        "name": "Santa Clara",
      "recorder"  : "Android",
      "direction": "0"
    }
  ]
}

The JSONPath expression $.directions[*].direction would return:
[
  "0",
  "270",
  "180",
  "0"
]

This would allow SplitJson to create four flowfiles with the derived content and fragment attributes to correlate them back to the original flowfile.  
If you actually need to perform permutation logic on the resulting direction & recorder values, you may want to use ExecuteScript with a simple Groovy/Ruby/Python script to do that operation inline and split out the resulting values. 