Skip to content

Instantly share code, notes, and snippets.

View Akintola's full-sized avatar
🏠
Working from home

Franck ADJIBAO Akintola

🏠
Working from home
View GitHub Profile
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/calls_details_2021/_search?size=0&pretty" -d '
{
"aggs": {
"number_calls_per_caller": {
"terms": {
"field": "caller_name"
}
}
}
}'
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/calls_details_2021/_search?size=0&pretty" -d '
{
"aggs": {
"average_time": { "avg": { "field": "duration" } }
}
}'
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/calls_details_2021/_search?size=0&pretty" -d '
{
"aggs": {
"max_call_duration":
{ "max": { "field": "duration" }
}
}
}'
curl -XPUT -H "Content-Type: application/json" "127.0.0.1:9200/calls_details_2021?pretty" -d '
{
"mappings": {
"properties": {
"caller_name": { "type": "keyword" },
"caller_city": { "type": "keyword" },
"destinator_name": { "type": "keyword" },
"destinator_city": { "type": "keyword" }
}
}
curl -XPOST -H "Content-Type: application/json" "127.0.0.1:9200/_bulk?pretty" -d '
{ "create" : { "_index" : "calls_details_2021", "_id" : "1" } }
{ "id": "1", "caller_name" : "John", "caller_city": "Miami" , "destinator_name": "Aina", "destinator_city": "Paris", "duration": 30, "date": "2021-01-02"}
{ "create" : { "_index" : "calls_details_2021", "_id" : "2" } }
{ "id": "2", "caller_name" : "John", "caller_city": "Miami" , "destinator_name": "Akintola", "destinator_city": "Lagos", "duration": 20, "date": "2021-01-02"}
{ "create" : { "_index" : "calls_details_2021", "_id" : "3" } }
{ "id": "3", "caller_name" : "Torsten", "caller_city": "Berlin" , "destinator_name": "Clarice", "destinator_city": "Montreal", "duration": 5, "date": "2021-01-02"}
{ "create" : { "_index" : "calls_details_2021", "_id" : "4" } }
{ "id": "4", "caller_name" : "John", "caller_city": "Miami" , "destinator_name": "Aina", "destinator_city": "Paris", "duration": 15, "date": "2021-01-03"}
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/mangas/_search?pretty" -d '
{
"query": {
"bool" : {
"filter": {
"term" : { "year" : 1990 }
}
}
}
}'
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/mangas/_search?pretty" -d '
{
"query": {
"bool" : {
"must_not": {
"match" : { "title" : "One" }
}
}
}
}'
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/mangas/_search?pretty" -d '
{
"query": {
"bool" : {
"must" : {
"match" : { "title" : "ma"}
},
"should" : {
"term" : { "tags" : "Piece" }
}
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/mangas/_search?pretty" -d '
{
"query": {
"bool" : {
"must" : {
"match" : { "title" : "ma"}
}
}
}
}'
curl -XGET -H "Content-Type: application/json" "127.0.0.1:9200/mangas/_search?pretty" -d '
{
"query": {
"bool" : {
"must" : {
"match" : { "title" : "ma"}
},
"must_not" : {
"range" : {
"age" : { "gte" : 1800, "lte" : 1995 }