[
// Default query template
{
"query": {
"bool": {
"must": ["filters"]
}
}
},
// visited = true sort_by = [-visits,last_visit] limit = 15
{
"query": {
"bool": {
"must": [{"term": {"has_visits": true}}]
}
}
},
// (((visited = true and visits > 0)))
{
"query": {
"bool": {
"must": [{
"bool": {
"must": [
{"term": {"has_visits": true}},
{"range": {"nb_visits": {"gt": 0}}}
]
}
}]
}
}
},
// origin : django or metadata : "framework and web"
{
"query": {
"bool": {
"must": [{
"bool": {
"should": [
{
"multi_match": {
"query": "django",
"type": "bool_prefix",
"operator": "and",
"fields": [
"url.as_you_type",
"url.as_you_type._2gram",
"url.as_you_type._3gram"
]
}
},
{
"nested": {
"path": "intrinsic_metadata",
"query": {
"multi_match": {
"query": "framework and web",
"type": "cross_fields",
"operator": "and",
"fields": ["intrinsic_metadata.*"],
"lenient": true
}
}
}
}
]
}
}]
}
}
},
// visits != 5
{
"query": {
"bool": {
"must": [{
"bool": {"must_not": [{"range": {"nb_visits": {"gte": 5, "lte": 5}}}]}
}]
}
}
},
// visit_type = [git,"pypi"]
{
"query": {
"bool": {
"must": [
{"terms": {"visit_types": ["git", "pypi"]}}
]
}
}
}
]