Last active
April 7, 2023 11:56
-
-
Save craigeddy/ff51f0d207ec15cb64ce1d9bafe1edcc to your computer and use it in GitHub Desktop.
Elasticsearch query that creates a word cloud from a partition of social media posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET posts/_search | |
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"match": { | |
"partitionKey.keyword": "9e6f80e6-d834-4d63-a37d-1845e90b4007" | |
} | |
}, | |
{ | |
"terms": { | |
"postType": ["Like", "Post", "Reply", "Repost"] | |
} | |
} | |
] | |
} | |
}, | |
"size": 0, | |
"aggs": { | |
"cloud": { | |
"terms": { | |
"field": "content.stop", | |
"size": 20 | |
}, | |
"aggs": { | |
"avg_sentiment": { | |
"avg": { | |
"field": "sentiment" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment