Skip to content

Instantly share code, notes, and snippets.

@AhmedHelalAhmed
Created September 17, 2018 08:37
Show Gist options
  • Select an option

  • Save AhmedHelalAhmed/2c8f0a0a911a0f5c41ae8ead73cfdcf6 to your computer and use it in GitHub Desktop.

Select an option

Save AhmedHelalAhmed/2c8f0a0a911a0f5c41ae8ead73cfdcf6 to your computer and use it in GitHub Desktop.
ElasticSearch - sense query
GET _search
{
"query":
{
"match_all": {}
}
}
Get /
POST /pets/dog/_search
POST /pets/dog/_search
{
"query":
{
"match":
{
"about": "ipsum"
}
}
}
POST /pets/dog/_search
{
"query":
{
"bool":
{
"must":
[
{
"match": { "about": "ipsum" }
}
]
}
}
}
POST /pets/dog/_search
{
"query":
{
"bool":
{
"must":
[
{
"match": { "about": "ipsum" }
}
],
"should":
[
{
"term": {"goodDog": true}
},
{
"term": {"gender": "male"}
}
]
}
}
}
POST /pets/dog/_search?explain
{
"query":
{
"bool":
{
"must":
[
{
"match": { "about": "ipsum" }
}
],
"should":
[
{
"term": {"goodDog": true}
},
{
"term": {"gender": "male"}
}
]
}
}
}
POST /pets/dog/_search
{
"query":
{
"bool":
{
"must":
[
{
"match": { "about": "ipsum" }
}
],
"filter":
[
{
"range":
{
"registered":
{
"gte": "2015-01-01"
}
}
}
]
}
}
}
GET /pets/bird/_search
{
"query":
{
"match_all": {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment