ElasticSearch CouchDB河 - 明确指定字段类型

时间:2013-09-06 19:05:49

标签: couchdb elasticsearch

我正在使用ElasticSearch河来索引CouchDB推文数据库。 “created_at”字段不符合“日期”类型,并被索引为String。 如何在明确指定“created_at”为日期的情况下启动河流,以便我可以对其进行范围查询?

我尝试了以下河流请求,但它无效,该字段仍被编入索引:

curl -XPUT 'localhost:9200/_river/my_db/_meta' -d '{
    "type" : "couchdb",
    "couchdb" : {
        "host" : "localhost",
        "port" : 5984,
        "db" : "testtweets",
        "filter" : null
    },
    "index" : {
        "index" : "my_testing",
        "type" : "my_datetesting",
        "properties" : {"created_at": {
                                    "type" : "date",
                                    "format" : "yyyy-MM-dd HH:mm:ss"
                                    }
                        },
        "bulk_size" : "100",
        "bulk_timeout" : "10ms"
    }
}'

我的数据如下:

{
   "_id": "262856000481136640",
   "_rev": "1-0ed7c0fe655974e236814184bef5ff16",
   "contributors": null,
   "truncated": false,
   "text": "RT @edoswald: Ocean City MD first to show that #Sandy is no joke. Pier badly damaged, sea nearly topping the seawall http://t.co/D0Wwok4 ...",
   "author_name": "Casey Strader",
   "author_created_at": "2011-04-21 20:00:32",
   "author_description": "",
   "author_location": "",
   "author_geo_enabled": false,
   "source": "Twitter for iPhone",
   "retweeted": false,
   "coordinates": null,
   "author_verified": false,
   "entities": {
       "user_mentions": [
           {
               "indices": [
                   3,
                   12
               ],
               "id_str": "10433822",
               "id": 10433822,
               "name": "Ed Oswald",
               "screen_name": "edoswald"
           }
       ],
       "hashtags": [
           {
               "indices": [
                   47,
                   53
               ],
               "text": "Sandy"
           }
       ],
       "urls": [
           {
               "indices": [
                   117,
                   136
               ],
               "url": "http://t.co/D0Wwok4",
               "expanded_url": "http://t.co/D0Wwok4",
               "display_url": "t.co/D0Wwok4"
           }
       ]
   },
   "in_reply_to_screen_name": null,
   "author_id_str": "285792303",
   "retweet_count": 98,
   "id_str": "262856000481136640",
   "favorited": false,
   "source_url": "http://twitter.com/download/iphone",
   "author_screen_name": "Casey_Rae22",
   "geo": null,
   "in_reply_to_user_id_str": null,
   "author_time_zone": "Eastern Time (US & Canada)",
   "created_at": "2012-10-29 09:58:48",
   "in_reply_to_status_id_str": null,
   "place": null
}

谢谢!

0 个答案:

没有答案
相关问题