Skip to content

Instantly share code, notes, and snippets.

@eskibars
Created August 10, 2017 20:36
Show Gist options
  • Save eskibars/ec4afb8bcc6f2917b89f729fcaca67d6 to your computer and use it in GitHub Desktop.
Save eskibars/ec4afb8bcc6f2917b89f729fcaca67d6 to your computer and use it in GitHub Desktop.
Example of date search
PUT t
PUT /t/t/_mapping
{
"properties": {
"publishdate": {
"type": "date"
}
}
}
POST /t/t
{
"publishdate": "2001-02-03T04:56:00"
}
GET /t/t/_search
{
"query": {
"bool": {
"filter": {
"range": {
"publishdate": {
"lt": "now"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment