I have the following search query that I've been using so far to display the unique values in lists of Ids:
<search>
| eval ids=if(group_id >= 4, id, '')
| eval type_x_ids=if((group_id >= 4 AND is_type_x="true"), id, '')
| eval non_type_x_ids=if((group_id >= 4 AND is_type_x="false"), id, '')
| stats count as total_count, values(type_x_ids) as list_of_x_ids, values(non_type_x_ids) as list_of_non_x_ids, values(ids) as list_of_all_ids by some_characteristic
Now that I've seen which Ids are in the lists, I would like to change the query to count the number of unique ids in the lists split up by some characteristic. mvcount doesn't seem to work in the stats command the way I tried it:
attempt 1:
| stats count as total_count, mvcount(type_x_ids) as num_of_x_ids, mvcount(non_type_x_ids) as num_of_non_x_ids, mvcount(ids) as num_of_all_ids by some_characteristic
attempt 2:
| stats count as total_count, mvcount(values(type_x_ids)) as num_of_x_ids, mvcount(values(non_type_x_ids)) as num_of_non_x_ids, mvcount(values(ids)) as num_of_all_ids by some_characteristic
How should I write the stats line so I would get a table that shows the number of unique of Ids in each list of Ids split by some characteristic? I would like the following fields in my resulting table:
| some_characteristic | total_count | num_of_x_ids | num_of_non_x_ids | num_of_all_ids |
I would appreciate any help you can give!!
| stats count as total_count, values(type_x_ids) as list_of_x_ids, dc(type_x_ids) as count_of_x_ids, values(non_type_x_ids) as list_of_non_x_ids, dc(non_type_x_ids) as count_of_non_x_ids, values(ids) as list_of_all_ids, dc(ids) as count_of_all_ids by some_characteristic
dc was exactly what I was looking for! Thank you so much!
| stats count as total_count, values(type_x_ids) as list_of_x_ids, dc(type_x_ids) as count_of_x_ids, values(non_type_x_ids) as list_of_non_x_ids, dc(non_type_x_ids) as count_of_non_x_ids, values(ids) as list_of_all_ids, dc(ids) as count_of_all_ids by some_characteristic