Derived Unique values from the unique values

I have a csv with a system-ip (String) in 56th field and Errors in the 12th field. When ever my ip struct with an error its writing a error log and I am parsing it to elastic search. Now I want to see which ip is getting which error and how many times.

{ "size": 0, "aggs" : { "langs" : { "terms" : { "field" : "column56" } } }}
From this I can get all unique ip. Now I want ito know in that ip how many errors (12th filed) I get and count of that error... Thanks for any help

You can embed another terms aggregation inside the first one, which will give you a list of errors-per-IP (and counts).

{
  "size": 0,
  "aggs" : {
    "langs" : {
      "terms" : { "field" : "column56" },
      "aggs": {
         "errors": {
            "terms" : { "field" : "column12" }
         }
      }
    }
  }
}