Javascript problem


(rr_silicon) #1

I have a script that was running on ES 5.x and that I tried now on ES 6.2.4.

define(['scripts/d3.v4', 'scripts/elasticsearch'], function (d3, es) {

"use strict";

var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height");

var format = d3.format(",d");

var color = d3.scaleOrdinal(d3.schemeCategory20c);

var pack = d3.pack()
.size([width, height])
.padding(1.5); 

var client = new elasticsearch.Client({ 
host: 'http://192.168.10.151:9200'
});

client.search({
index: 'ips-inx',
size: 0,
body: {
    "size": 0,
    "aggs" : {
            "recent": {
                "filter": {
                    "range": {
                        "timestamp": {
                            "from": "now-1M"
                        }
                    }
                }
            }
    },
    "aggs": {
        "srcs" : {
            "terms" : {
                "field" : "src_ip",
                "size" : 10
            },
            "aggs" : {
                "dsts" : {
                    "terms" : {
                        "field" : "dst_ip",
                        "size" : 10
                    }
                }
            }
        }
    }
}
}).then(function(d) {
  console.log(d);
  d.value = +d.value;
  if (d.value) return d;

I get the following error that I don't undertand once the debugger proceed from the fourth last line above. - }).then(function(d) {

Appreciate assistance.


(rr_silicon) #2

Solved. I made an error when creating index. Corrected the mappings and it worked.


(system) #3

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