Skip to content

Instantly share code, notes, and snippets.

View wnqueiroz's full-sized avatar
:octocat:

William Queiroz wnqueiroz

:octocat:
View GitHub Profile
@wnqueiroz
wnqueiroz / .sh
Last active May 28, 2018 01:54
Up elasticsearch container
docker container run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.4
@wnqueiroz
wnqueiroz / .js
Last active May 28, 2018 02:25
john_watson
{
"id": 1,
"name": "John Watson",
"email": "john@watson.com",
"created_at": "2018-05-28T04:28:28+03:00"
}
@wnqueiroz
wnqueiroz / john_watson_post.js
Created May 28, 2018 02:27
john_watson_post
{
"title": "This is a user post 1...",
"body": "This is a body...",
"user": 1
}
@wnqueiroz
wnqueiroz / john_watson_find_posts.js
Created May 28, 2018 02:35
john_watson_find_posts.js
{
"query": {
"bool": {
"filter": {
"term": {
"user": 1
}
}
}
}
@wnqueiroz
wnqueiroz / find_users_called_John.js
Created May 28, 2018 02:40
find_users_called_John.js
{
"query": {
"match": {
"name": "John"
}
}
}
@wnqueiroz
wnqueiroz / find_posts_by_user_id.js
Created May 28, 2018 02:43
find_posts_by_user_id.js
{
"query": {
"bool": {
"filter": {
"terms": {
"user": [
1
]
}
}
@wnqueiroz
wnqueiroz / john_watson_post_denormalized.js
Created May 29, 2018 01:01
john_watson_post_denormalized.js
{
"title": "This is a user post 1...",
"body": "This is a body...",
"user": {
"id": 1,
"name": "John Watson",
"email": "john@watson.com"
}
}
@wnqueiroz
wnqueiroz / query_denormalized_data.js
Created May 29, 2018 01:07
query_denormalized_data.js
{
"query": {
"bool": {
"must": [
{
"match": {
"title": "post 1"
}
},
{
@wnqueiroz
wnqueiroz / john_watson_post_with_comments.js
Created June 3, 2018 22:51
john_watson_post_with_comments.js
{
"title": "This is a user post 1...",
"body": "This is a body...",
"user": {
"id": 1,
"name": "John Watson",
"email": "john@watson.com"
},
"comments": [
{
@wnqueiroz
wnqueiroz / query_with_incorrect_match.js
Created June 3, 2018 22:57
query_with_incorrect_match.js
{
"query": {
"bool": {
"must": [
{
"match": {
"comments.name": "Alice"
}
},
{