Skip to content

Instantly share code, notes, and snippets.

@DevWurm
Last active August 25, 2016 12:29
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 DevWurm/524c8dcdf70413e05f16a4c6a03553ee to your computer and use it in GitHub Desktop.
Save DevWurm/524c8dcdf70413e05f16a4c6a03553ee to your computer and use it in GitHub Desktop.
Elasticsearch Query
{
"settings": {
"number_of_shards" : 10,
"number_of_replicas" : 0
},
"mappings": {
"article": {
"properties": {
"name": {"type": "string"},
"counts": {
"type": "nested",
"properties": {
"date": {"type": "date", "format": "strict_date_time"},
"count": {"type": "long"}
}
}
}
}
}
}
{"_source":
["article","counts.*"],
"query": {
"bool": {
"filter": {
"bool": {
"must_not":[]
}
}
}
},
"sort": [{
"counts.count": {
"order":"asc",
"mode": "max",
"nested_path": "counts"
"nested_filter": {
"bool": {
"must": {
"match": {
"counts.date":"2016-07-01T07:00:00.000Z"
}
}
}
}
}
}]
}
@DevWurm
Copy link
Author

DevWurm commented Aug 25, 2016

Die Intention des Query ist es alle Artikel nach den Counts am 01.07.2016 um 07:00 zu sortieren

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment