1

Consider I have the following data in my Elastic index.

"hits" : [ { "_index" : "cubepoc", "_type" : "_doc", "_id" : "i1", "_score" : 1.0, "_source" : { "pname" : "john doe", "pconcern" : "cough and fever", "product" : [ { "medicine1" : "medomol", "medicine2" : "aspirin" } ] } } ]

So in order to access the product, I would need to do a nested query in elastic. How could I achieve the same through Cube.js schema?

The following is my cubejs schema.

cube(`Cubepoc`, {
  sql: `SELECT * FROM cubepoc`,

  joins: {},

  measures: {},

  dimensions: {
    pname: {
      sql: `pname`,
      type: `string`,
      title: `Patient Name`
    },
    pconcern: {
      sql: `pconcern`,
      type: `string`,
      title: `Patient Concern`
    },
    product: {
      sql: `product`,
      type: `string`,
      title: `Patient Product`
    }
  }
});

Since the product is of type nested in Elastic, defining it as the string doesn't help to access it.

Help me to generate the correct schema.

Vignesh G
  • 151
  • 6
  • Were you able to achieve this? – Manoj Sethi Jun 18 '21 at 01:51
  • https://github.com/cube-js/cube.js/issues/1070 Please find the GitHub issue raised. Yet the above feature is not achievable. Please feel free to share the solution if you could find any. – Vignesh G Jun 18 '21 at 04:32

0 Answers0