Using EsStorage for nested data


(Vijaym123) #1

Hello Everyone,

Here is my pig script;
A = load '/projects/blog' using AvroStorage();
B =LIMIT A 5;
STORE B INTO 'blog/user' USING org.elasticsearch.hadoop.pig.EsStorage('es.nodes = test.myes.com','es.port = 80');

B's schema :
B: {name: chararray, id: long, segments: {ARRAY_ELEM: (message:string, stars: int, date:string)}}

and want to put it in ES with the nested mapping:

{
  "mappings": {
    "blogpost": {
      "properties": {
        "name": {
          "type": "string",
          "store": true
        },
        "id": {
          "type": "long",
          "store": true
        },
        "comments": {
          "type": "nested", 
          "properties": {
            "message": { "type": "string"  },
            "stars":   { "type": "int"   },
            "date":    { "type": "string" }
          }
        }
      }
    }
  }
}
Can you guys please help me with parameters that I need to pass to EsStorage to have nested structure?

Thanks,
Vijay


(system) #2