Search query execution

Learn how to execute search queries in embedded Tellius Search using postMessage API—send queries, receive visualizations, and integrate results seamlessly.

After connecting with Tellius, the embedding app will contain the Search page component from Tellius. Once the Search page is loaded in the embedding app, users can type the required query in the search box.

Request

After typing the query and clicking on Enter, the following postMessage (consisting of the query) will be sent from Tellius:

{
   "actionType":"SEARCH_QUERY_REQUEST",
   "corrId":"4y1XV",
   "enterKeyPress":true,
   "performQuery":true,
   "query":"show total profit"
}

Response

After receiving the result, the following postMessage will be sent from Tellius:

{
   "actionType":"SEARCH_QUERY_RESPONSE",
   "vizResponse":{
      "vizResponseType":"kpi",
      "viz":{
         "vizType":"kpi",
         "title":"Total profit",
         "theme":{
            "vizBackground":{
               "transparency":"0.9",
               "image":"img/test",
               "color":"white"
            },
            "name":"dark",
            "color":"black"
         },
         "size":{
            "width":200,
            "height":100
         },
         "placement":{
            "yDistance":20,
            "xDistance":10
         },
         "metadata":{
            "language":"english",
            "format":{
               "title":{
                  "font":{
                     "weight":"normal",
                     "size":"16",
                     "color":"#000000"
                  },
                  "enabled":true
               },
               "legend":{
                  "font":{
                     "weight":"normal",
                     "size":"14",
                     "color":"#78909c"
                  },
                  "enabled":true
               },
               "colorPaletteInfo":{
                  "colors":[
                     "#1565C0",
                     "#F57F17",
                     "#558B2F",
                     "#BF360C",
                     "#5E35B1",
                     "#00838F",
                     "#C62828",
                     "#827717",
                     "#E65100",
                     "#5D4037",
                     "#AD1457",
                     "#6A1B9A",
                     "#1976D2",
                     "#F9A825",
                     "#689F38",
                     "#D84315",
                     "#673AB7",
                     "#0097A7",
                     "#D32F2F",
                     "#9E9D24",
                     "#EF6C00",
                     "#6D4C41",
                     "#C2185B",
                     "#7B1FA2",
                     "#42A5F5",
                     "#FFEB3B",
                     "#9CCC65",
                     "#FF8A65",
                     "#9575CD",
                     "#4DD0E1",
                     "#EF5350",
                     "#C0CA33",
                     "#FF9800",
                     "#8D6E63",
                     "#EC407A",
                     "#AB47BC",
                     "#64B5F6",
                     "#FFF176",
                     "#AED581",
                     "#FFAB91",
                     "#B39DDB",
                     "#80DEEA",
                     "#E57373",
                     "#D4E157",
                     "#FFB74D",
                     "#A1887F",
                     "#F06292",
                     "#BA68C8",
                     "#90CAF9",
                     "#FFF59D",
                     "#C5E1A5",
                     "#FFCCBC",
                     "#D1C4E9",
                     "#B2EBF2",
                     "#EF9A9A",
                     "#DCE775",
                     "#FFCC80",
                     "#BCAAA4",
                     "#F48FB1",
                     "#CE93D8"
                  ]
               },
               "background":{
                  "enableGrid":false,
                  "color":"#FFFFFF"
               },
               "axes":{
                  "yAxis":{
                     "enabled":true
                  },
                  "xAxis":{
                     "enabled":true
                  },
                  "font":{
                     "weight":"normal",
                     "size":"14",
                     "color":"#78909c"
                  }
               }
            },
            "dualAxis":true,
            "colorPalette":"401300fe-58ae-42ad-b185-ce1f4a181d73"
         },
         "id":"5f6b92e5-6711-4c8b-841f-763cf9f7b171",
         "chartType":"simpleCount",
         "businessViewId":"bv_d5dfeeb5-9a4a-4fac-92a0-a51a07da52d9",
         "axes":{
            "yAxis":[
               {
                  "columnName":"profit",
                  "aggregation":"sum"
               }
            ],
            "isMultipleAxes":false
         }
      },
      "tooltip":[
         {
            "translatedAggregation":"sum",
            "originalValue":2698921,
            "isYAxis":true,
            "isXAxis":false,
            "isGroupBy":false,
            "formattedValue":"2.7M",
            "columnName":"profit",
            "alias":"profit",
            "aggregation":"sum"
         }
      ],
      "responseText":"**Total profit** is **2698921**",
      "possibleTransitions":[
         "funnel",
         "detailTable",
         "simpleCount",
         "radialProgress",
         "viewData",
         "interactiveTable",
         "histogram",
         "bar",
         "column",
         "barConversion",
         "table"
      ],
      "possibleBucketInfo":{
         "possibleBuckets":{
            "measureType":{
               "values":{
                  "tooltips":5,
                  "measures":0
               }
            }
         }
      },
      "metadata":{
         "tqlResponseRowCount":1,
         "totalRowCount":0,
         "timeTakenInMilliSeconds":244,
         "responseDataCount":1
      },
      "count":"2.7M",
      "columns":[
         {
            "name":"profit",
            "format":{
               "type":"number",
               "isCommaSeparated":false,
               "displayUnit":"default",
               "decimals":2
            },
            "datasetName":"bv_guide_query",
            "datasetId":"bv_d5dfeeb5-9a4a-4fac-92a0-a51a07da52d9",
            "aggregation":"sum"
         }
      ],
      "columnDetails":{
         "measureType":[
            {
               "column":{
                  "name":"profit",
                  "isWeekEndDate":false,
                  "aggregation":"sum"
               },
               "bucket":"measures"
            }
         ],
         "dimensionType":[                     ],
         "dateType":[                     ]
      }
   },
   "responseType":"vizResponse",
   "metadata":{
      "witResponse":{
         "query":"show total profit",
         "intent":"Chart",
         "entities":{
            "businessViewId":[
               {
                  "value":{
                     "value":"bv_d5dfeeb5-9a4a-4fac-92a0-a51a07da52d9",
                     "type":"string"
                  },
                  "start":0,
                  "end":0,
                  "confidence":1
               }
            ],
            "aggregatedField":[
               {
                  "value":{
                     "type":"aggregation",
                     "columnStartIndexInQuery":11,
                     "aggregationField":{
                        "name":"profit",
                        "isExpression":false,
                        "datasetName":"bv_guide_query",
                        "datasetId":"bv_d5dfeeb5-9a4a-4fac-92a0-a51a07da52d9",
                        "databaseTable":"bv_d5dfeeb5-9a4a-4fac-92a0-a51a07da52d9"
                     },
                     "aggregation":"total"
                  },
                  "start":5,
                  "end":17,
                  "confidence":1
               }
            ]
         },
         "confidence":0.9183534383773804
      },
      "tokens":[
         {
            "type":"measure",
            "tokenString":"total profit",
            "suggestions":[
               {
                  "type":"measure",
                  "tokenString":"avg profit",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"profit"
                  },
                  "aggregation":"avg"
               },
               {
                  "type":"measure",
                  "tokenString":"min profit",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"profit"
                  },
                  "aggregation":"min"
               },
               {
                  "type":"measure",
                  "tokenString":"max profit",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"profit"
                  },
                  "aggregation":"max"
               },
               {
                  "type":"measure",
                  "tokenString":"total profit",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"profit"
                  },
                  "aggregation":"total"
               },
               {
                  "type":"measure",
                  "tokenString":"marketShare profit",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"profit"
                  },
                  "aggregation":"marketShare"
               },
               {
                  "type":"measure",
                  "tokenString":"sum cost",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"cost"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum customer_id",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"customer_id"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum revenue",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"revenue"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum store_id",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"store_id"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum competition_distance",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"competition_distance"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum store_lat",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"store_lat"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum store_lon",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"store_lon"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum store_zip",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"store_zip"
                  },
                  "aggregation":"sum"
               },
               {
                  "type":"measure",
                  "tokenString":"sum age",
                  "suggestions":[                                       ],
                  "column":{
                     "name":"age"
                  },
                  "aggregation":"sum"
               }
            ],
            "start":5,
            "end":17,
            "column":{
               "name":"profit"
            },
            "aggregation":"sum"
         }
      ],
      "suggestions":[               ],
      "rowsCount":1,
      "responseType":"viz",
      "original":"show total profit",
      "filterDescriptions":[               ],
      "chartType":"simpleCount",
      "chartTitle":"Total profit",
      "BVId":"bv_d5dfeeb5-9a4a-4fac-92a0-a51a07da52d9"
   },
   "corrId":"4y1XV",
   "filterDescriptions":[         ]
}

Add to Vizpads

For more details on adding Search to a Vizpad, please refer to this section.

Last updated

Was this helpful?