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!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...