Skip to content

Commit 41863ff

Browse files
committed
Adding Console examples
1 parent 490595d commit 41863ff

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

queries.md

+24-16
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88

99
### Elasticsearch
1010

11+
#### Using curl
12+
1113
curl 'http://localhost:9200/enron/_search?pretty&q=subject:monetary&fields=subject'
1214

15+
#### Using Console (fka Sense)
16+
17+
GET /enron/_search?q=subject:monetary&fields=subject
18+
1319
## Search for text in multiple fields
1420

1521
### SQL
@@ -18,8 +24,13 @@
1824

1925
### Elasticsearch
2026

27+
#### Using curl
28+
2129
curl 'http://localhost:9200/enron/_search?pretty&q=subject:monetary+body:monetary&fields=subject'
2230

31+
#### Using Console (fka Sense)
32+
33+
GET /enron/_search?q=subject:monetary+body:monetary&fields=subject
2334

2435
## Search for a phrase
2536

@@ -29,6 +40,8 @@
2940

3041
### Elasticsearch
3142

43+
#### Using curl
44+
3245
curl -XPOST 'http://localhost:9200/enron/_search?pretty&fields=subject' -d'
3346
{
3447
"query": {
@@ -38,21 +51,16 @@
3851
}
3952
}'
4053

41-
## Show top 10 senders
42-
43-
### SQL
44-
45-
SELECT sender, COUNT(*) AS num_emails_sent FROM emails GROUP BY sender ORDER BY num_emails_sent DESC LIMIT 10;
54+
#### Using Console (fka Sense)
4655

47-
### Elasticsearch
48-
49-
curl -XPOST 'http://localhost:9200/enron/_search?pretty' -d '{
50-
"size": 0,
51-
"aggs": {
52-
"top_10_senders": {
53-
"terms": {
54-
"field": "sender"
55-
}
56+
POST /enron/_search
57+
{
58+
"query": {
59+
"match_phrase": {
60+
"body": "monetary fund"
5661
}
57-
}
58-
}'
62+
},
63+
"fields": [
64+
"subject"
65+
]
66+
}

0 commit comments

Comments
 (0)