datavis-tech / es-tabify

A function that converts ElasticSearch results into a table data structure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multiple metric aggregation test case is not working

kullu208025 opened this issue · comments

Please help!!
Following test case is not working

{
  "took" : 24,
  "timed_out" : false,
  "_shards" : {
    "total" : 107,
    "successful" : 107,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "2" : {
      "value" : 89.47877310881191
    },
    "3" : {
      "value" : 4.8758952E7
    }
  }
}

by processing above output using tabify OUTPUT =
[ { '2': 89.47877310881191 } ]
aggregation with key '3' is missing

PRs Welcome :)

Adding this as a failing test case would be a great start.

Sorry closed it by mistake....

PRs Welcome :)

Adding this as a failing test case would be a great start.

How do i add it as a failing test case

I would recommend using Mocha, with a similar configuration to this other project:

I would recommend using Mocha, with a similar configuration to this other project:

* Add this script to `package.json` https://github.com/datavis-tech/topologica/blob/master/package.json#L9

* Add a file `test.js` using patterns similar to these https://github.com/datavis-tech/topologica/blob/master/test.js

* Import the function, add a test case

Actually i am new to nodejs , My code till now looks like

const tabify = require('./app/library/tabify');
var test_case = {
  "took" : 24,
  "timed_out" : false,
  "_shards" : {
    "total" : 107,
    "successful" : 107,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "2" : {
      "value" : 89.47877310881191
    },
    "3" : {
      "value" : 4.8758952E7
    }
  }
};
console.log(tabify(test_case));

Output : [ { '2': 89.47877310881191 } ].
Can you please help me with this one .....