ElasticSQL math operation

Hi.

I need to substract two queries. I have try this

SELECT SUM ((SELECT COUNT () AS "op_totals" FROM "app20-" WHERE "path" = '/ops/login') - (SELECT COUNT () AS "op_succ" FROM "app20-" WHERE "operacion" = 79)) AS "op_fail"

But I get an error that

Expression failed with the message:

[essql] > Unexpected error from Elasticsearch: [unsupported_operation_exception] null

What I'm doing wrong? Please HELP!!!!
:(:cry:

Hi @Woolis_Xiibil_Peek,

This type of operation is not supported. Anything that involves sub-selects is in general unsupported.

Is there another way to do it?

What is your complete query?

Hi Andrei.

I need to substract this two queries.

SELECT COUNT () AS "op_totals" FROM "app20-" WHERE "path" = '/ops/login'

and

SELECT COUNT () AS "op_succ" FROM "app20-" WHERE "operacion" = 79

Something like op_totals - op_succ

I also have try

SELECT COUNT("path") - COUNT("operacion") AS "x" FROM "app20-*" WHERE "path" = '/ops/login' (something) "operacion" = 79

But I missing something between path and operaci贸n on WHERE sentence

Could you do something like
SELECT COUNT(*) as "total" FROM "app20-" WHERE "path" = '/ops/login' AND "operacion" != 79

Maybe I'm missing something.

Hi.

Thank you, but it didn't make what I looking for.

I like to make the substraction of the total of the operations minus the succesful operations to get the failed operations.

ops_failed = ops_total - ops_ succ.

I use this two queries to get the values

  1. SELECT COUNT ( ) AS "op_totals" FROM "app20- " WHERE "path" = '/ops/login'
  2. SELECT COUNT ( ) AS "op_succ" FROM "app20- " WHERE "operacion" = 79

But I'm failling making the math operation.