Splunk Search

splunk app for NLP : trying to get average sentiment by index

denymw
Explorer

Hi, I am trying to get a visualization to show the average sentiment of a search term by the index.

index=* foo | table text| vader textfield=text| stats avg(sentiment) as sentiment

as expected gives me a decimal return labelled sentiment

index=* foo | table text| vader textfield=text| stats avg(sentiment)

returns the same decimal unlabeled

but I can not get
index=* foo | table text| vader textfield=text| stats avg(sentiment) by index

to return a sentiment decimal based on the results from the different indexes, I am obviously going wrong somewhere but I can not work out where, any help is greatly appreciated.

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@denymw,

In your search, you are using | table text which restricts the fields to only text. If you need index also part of your stats , add index also to the table command or remove the table command completely.

Try

index=* foo | vader textfield=text| stats avg(sentiment) as sentiment by index
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

@denymw,

In your search, you are using | table text which restricts the fields to only text. If you need index also part of your stats , add index also to the table command or remove the table command completely.

Try

index=* foo | vader textfield=text| stats avg(sentiment) as sentiment by index
---
What goes around comes around. If it helps, hit it with Karma 🙂

denymw
Explorer

thank you so much, I didn't even see I had copied that in.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...