oliver006 / elasticsearch-gmail

Index your Gmail Inbox with Elasticsearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run queries

bparanj opened this issue · comments

I am not able to run the queries shown in the readme.

$ curl -H 'Content-Type: application/json'  'http://localhost:9200/gmail/email/_search?
pretty&search_type=count' -d '{"aggs": { "emails":{"terms" : { "field" : "to",  "size": 10 }} } }'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "No search type for [count]"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "No search type for [count]"
  },
  "status" : 400
}

$ curl -H 'Content-Type: application/json' 'http://localhost:9200/gmail/email/_search?pretty' -d


```json
'{"filter": { "range" : { "date_ts" : {"gte": "now-6M" } } } }'
{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Unknown key for a START_OBJECT in [filter].",
        "line" : 1,
        "col" : 12
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Unknown key for a START_OBJECT in [filter].",
    "line" : 1,
    "col" : 12
  },
  "status" : 400
}

I can see some output for:

curl -H 'Content-Type: application/json' 'http://localhost:9200/_search' -d'
{
    "query" : {
        "match_all" : {}
    }
}'

Appreciate any help.

Which version of ES do you use? This tutorial was written over 4 years ago and, I think, the version of ES I used was (maybe) 1.7 so I wouldn't be surprised if the queries need a bit of updating.

Sorry about that :-/