Chart pie count field

(radi) #1

I have a pie of count split terms and I want make addition of some fields of this aggregation
exemple i have count of (women , men ,child girls, child boy )
but i have to make pie with count of (women+ child girls) and (men +child boy)

how can i do this please ?

(Peter Pisljar) #2

You would need to reindex your data and add another field like gender where you would set it to female if the first field is either women or child girls

you could also do that on-the-fly with scripted fields, however that will create a much bigger load and might not be appropriate if your dataset is big.

(radi) #3

Thank's for your answer can you give me exemple of scripted fileds similaire of my exemple please ?
there is no exemple similaire to my case !

(Peter Pisljar) #4

something like:

if (doc['field1'].value == 'women' || doc['field1'].value == 'girls') return 'female';
if (doc['field1'].value == 'men' || doc['field1'].value == 'boys') return 'male';
return 'n/a';

(radi) #5

my script filed work very good in visualize but when i call it in dashboard i have Error
"Could not locate that index-pattern-field (id: mynewscriptsfiledadd)"!

(Peter Pisljar) #6

that's weird ... should not happen i think.

could you open an issue on ?

(radi) #7

Yes, you are right it's should not happen , in my cas it's

thank's for your replay

(system) #9

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.