Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nulpunkt
Created October 28, 2016 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nulpunkt/ab928ae0f28e86662e8819e70cc96334 to your computer and use it in GitHub Desktop.
Save nulpunkt/ab928ae0f28e86662e8819e70cc96334 to your computer and use it in GitHub Desktop.
{
"query": {
"function_score": {
"filter": {
"and": [
{
"terms": {
"group_id": [
"576878"
]
}
}
]
},
"query": {
"bool": {
"minimum_should_match": 1,
"must_not": [
{
"match": {
"title": {
"query": ""
}
}
},
{
"match": {
"filename": {
"query": ""
}
}
},
{
"match": {
"filename": {
"query": ""
}
}
},
{
"match": {
"uploaded_by": {
"query": ""
}
}
},
{
"match": {
"description": {
"query": ""
}
}
},
{
"match": {
"copyright": {
"query": ""
}
}
},
{
"match": {
"keywords": {
"query": ""
}
}
}
],
"should": [
{
"match_phrase_prefix": {
"title": {
"query": "newkeyword"
}
}
},
{
"match_phrase_prefix": {
"filename": {
"query": "newkeyword"
}
}
},
{
"match": {
"filename": {
"query": "newkeyword"
}
}
},
{
"match_phrase": {
"uploaded_by": {
"query": "newkeyword"
}
}
},
{
"match_phrase_prefix": {
"description": {
"query": "newkeyword"
}
}
},
{
"match": {
"copyright": {
"query": "newkeyword"
}
}
},
{
"match": {
"byline": {
"query": "newkeyword"
}
}
},
{
"match_phrase_prefix": {
"title": {
"query": "stahoeustnh"
}
}
},
{
"match_phrase_prefix": {
"filename": {
"query": "stahoeustnh"
}
}
},
{
"match": {
"filename": {
"query": "stahoeustnh"
}
}
},
{
"match_phrase": {
"uploaded_by": {
"query": "stahoeustnh"
}
}
},
{
"match_phrase_prefix": {
"description": {
"query": "stahoeustnh"
}
}
},
{
"match": {
"copyright": {
"query": "stahoeustnh"
}
}
},
{
"match": {
"byline": {
"query": "stahoeustnh"
}
}
},
{
"match": {
"keywords": {
"boost": 8,
"query": [
"newkeyword",
"stahoeustnh"
]
}
}
},
{
"match": {
"keywords": {
"operator": "and",
"query": [
"newkeyword",
"stahoeustnh"
]
}
}
}
]
}
}
}
},
"sort": [
{
"_script": {
"lang": "groovy",
"order": "desc",
"script": "if (_source['title'] && _source['title'].trim())\n _source['title'].trim().toLowerCase() else _source['filename'].trim().toLowerCase()",
"type": "string"
}
},
"unique_media_id"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment