Skip to content

Instantly share code, notes, and snippets.

@mlaprise
Created April 14, 2016 15:17
Show Gist options
  • Save mlaprise/a504ab65376f75eefd46fda3e6da4be8 to your computer and use it in GitHub Desktop.
Save mlaprise/a504ab65376f75eefd46fda3e6da4be8 to your computer and use it in GitHub Desktop.
Sorting mentions by relevance
### Sort news by authority
GET documents-2016-04-12/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "viagra",
"fields": ["content.title", "content.text"]
}
},
{
"term": {
"type": {
"value": "news"
}
}
}
]
}
},
"sort": [
{
"entities.domainAuthority": {
"order": "desc"
},
"entities.pageAuthority": {
"order": "desc"
}
}
]
}
### Sort news by sentiment / authority
GET documents-2016-04-12/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "viagra",
"fields": ["content.title", "content.text"]
}
},
{
"term": {
"type": {
"value": "news"
}
}
},
{
"term": {
"content.language": {
"value": "English"
}
}
}
]
}
},
"sort": [
{
"entities.sentiment": {
"order": "asc"
},
"entities.domainAuthority": {
"order": "desc"
}
}
]
}
### Looks like The "web" and "social" type don't have the authorityMetrics
### In this case the number of inbound link seems to work well
GET documents-2016-04-12/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "apple",
"fields": ["content.title", "content.text"]
}
},
{
"term": {
"type": {
"value": "web"
}
}
}
]
}
},
"sort": [
{
"entities.inboundLinkCount": {
"order": "desc"
},
"entities.pageAuthority": {
"order": "desc"
}
}
]
}
### Sort tweets by reach (nbr. followers of author)
GET documents-2016-04-12/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "viagra",
"fields": ["content.title", "content.text"]
}
},
{
"term": {
"type": {
"value": "twitter"
}
}
}
]
}
},
"sort": [
{
"content.author.attributes.followersCount": {
"order": "desc"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment