elastic / stream2es

Stream data into ES (Wikipedia, Twitter, stdin, or other ESes)
355 stars 60 forks source link

Date format does not work on fr_FR systems #5

Closed dadoonet closed 11 years ago

dadoonet commented 11 years ago

Hey @drewr

I tried to use your new version and get stucked with date formats. I assume it's due to my MacOS version which is in french so my locale is fr_FR or something like that.

So basically, to make it work, I have to first create my index and set my own date settings for each date field as follow.

Note that dynamic_date_formats does not support locale attribute.

curl -XDELETE localhost:9200/twitter; echo

curl -XPUT localhost:9200/twitter -d '{
  "number_of_replicas":0,
  "refresh_interval":"1s",
  "number_of_shards":1
}'; echo

curl -XPUT localhost:9200/twitter/status/_mapping -d '{
    "status" : {
      "dynamic_date_formats" : [ "E MMM d HH:mm:ss Z yyyy" ],
      "_all" : {
        "enabled" : true
      },
      "properties" : {
        "bytes" : {
          "type" : "long"
        },
        "coordinates" : {
          "properties" : {
            "coordinates" : {
              "type" : "geo_point"
            },
            "type" : {
              "type" : "string"
            }
          }
        },
        "created_at" : {
          "type" : "date", "format" : "E MMM d HH:mm:ss Z yyyy", "locale": "en_EN"
        },
        "entities" : {
          "properties" : {
            "hashtags" : {
              "properties" : {
                "indices" : {
                  "type" : "long"
                },
                "text" : {
                  "type" : "string",
                  "index" : "not_analyzed",
                  "omit_norms" : true,
                  "index_options" : "docs"
                }
              }
            },
            "media" : {
              "properties" : {
                "display_url" : {
                  "type" : "string"
                },
                "expanded_url" : {
                  "type" : "string"
                },
                "id" : {
                  "type" : "long"
                },
                "id_str" : {
                  "type" : "string"
                },
                "indices" : {
                  "type" : "long"
                },
                "media_url" : {
                  "type" : "string"
                },
                "media_url_https" : {
                  "type" : "string"
                },
                "sizes" : {
                  "properties" : {
                    "large" : {
                      "properties" : {
                        "h" : {
                          "type" : "long"
                        },
                        "resize" : {
                          "type" : "string"
                        },
                        "w" : {
                          "type" : "long"
                        }
                      }
                    },
                    "medium" : {
                      "properties" : {
                        "h" : {
                          "type" : "long"
                        },
                        "resize" : {
                          "type" : "string"
                        },
                        "w" : {
                          "type" : "long"
                        }
                      }
                    },
                    "small" : {
                      "properties" : {
                        "h" : {
                          "type" : "long"
                        },
                        "resize" : {
                          "type" : "string"
                        },
                        "w" : {
                          "type" : "long"
                        }
                      }
                    },
                    "thumb" : {
                      "properties" : {
                        "h" : {
                          "type" : "long"
                        },
                        "resize" : {
                          "type" : "string"
                        },
                        "w" : {
                          "type" : "long"
                        }
                      }
                    }
                  }
                },
                "source_status_id" : {
                  "type" : "long"
                },
                "source_status_id_str" : {
                  "type" : "string"
                },
                "type" : {
                  "type" : "string"
                },
                "url" : {
                  "type" : "string"
                }
              }
            },
            "urls" : {
              "properties" : {
                "display_url" : {
                  "type" : "string"
                },
                "expanded_url" : {
                  "type" : "string"
                },
                "indices" : {
                  "type" : "long"
                },
                "url" : {
                  "type" : "string"
                }
              }
            },
            "user_mentions" : {
              "properties" : {
                "id" : {
                  "type" : "long"
                },
                "id_str" : {
                  "type" : "string"
                },
                "indices" : {
                  "type" : "long"
                },
                "name" : {
                  "type" : "string"
                },
                "screen_name" : {
                  "type" : "string"
                }
              }
            }
          }
        },
        "favorite_count" : {
          "type" : "long"
        },
        "favorited" : {
          "type" : "boolean"
        },
        "filter_level" : {
          "type" : "string"
        },
        "geo" : {
          "properties" : {
            "coordinates" : {
              "type" : "double"
            },
            "type" : {
              "type" : "string"
            }
          }
        },
        "id_str" : {
          "type" : "string"
        },
        "in_reply_to_screen_name" : {
          "type" : "string"
        },
        "in_reply_to_status_id" : {
          "type" : "long"
        },
        "in_reply_to_status_id_str" : {
          "type" : "string"
        },
        "in_reply_to_user_id" : {
          "type" : "long"
        },
        "in_reply_to_user_id_str" : {
          "type" : "string"
        },
        "lang" : {
          "type" : "string"
        },
        "offset" : {
          "type" : "long"
        },
        "place" : {
          "properties" : {
            "attributes" : {
              "type" : "object"
            },
            "bounding_box" : {
              "type" : "geo_shape"
            },
            "country" : {
              "type" : "string"
            },
            "country_code" : {
              "type" : "string"
            },
            "full_name" : {
              "type" : "string"
            },
            "id" : {
              "type" : "string"
            },
            "name" : {
              "type" : "string"
            },
            "place_type" : {
              "type" : "string"
            },
            "url" : {
              "type" : "string"
            }
          }
        },
        "possibly_sensitive" : {
          "type" : "boolean"
        },
        "retweet_count" : {
          "type" : "long"
        },
        "retweeted" : {
          "type" : "boolean"
        },
        "retweeted_status" : {
          "properties" : {
            "coordinates" : {
              "properties" : {
                "coordinates" : {
                  "type" : "double"
                },
                "type" : {
                  "type" : "string"
                }
              }
            },
            "created_at" : {
              "type" : "date", "format" : "E MMM d HH:mm:ss Z yyyy", "locale": "en_EN"
            },
            "entities" : {
              "properties" : {
                "hashtags" : {
                  "properties" : {
                    "indices" : {
                      "type" : "long"
                    },
                    "text" : {
                      "type" : "string"
                    }
                  }
                },
                "media" : {
                  "properties" : {
                    "display_url" : {
                      "type" : "string"
                    },
                    "expanded_url" : {
                      "type" : "string"
                    },
                    "id" : {
                      "type" : "long"
                    },
                    "id_str" : {
                      "type" : "string"
                    },
                    "indices" : {
                      "type" : "long"
                    },
                    "media_url" : {
                      "type" : "string"
                    },
                    "media_url_https" : {
                      "type" : "string"
                    },
                    "sizes" : {
                      "properties" : {
                        "large" : {
                          "properties" : {
                            "h" : {
                              "type" : "long"
                            },
                            "resize" : {
                              "type" : "string"
                            },
                            "w" : {
                              "type" : "long"
                            }
                          }
                        },
                        "medium" : {
                          "properties" : {
                            "h" : {
                              "type" : "long"
                            },
                            "resize" : {
                              "type" : "string"
                            },
                            "w" : {
                              "type" : "long"
                            }
                          }
                        },
                        "small" : {
                          "properties" : {
                            "h" : {
                              "type" : "long"
                            },
                            "resize" : {
                              "type" : "string"
                            },
                            "w" : {
                              "type" : "long"
                            }
                          }
                        },
                        "thumb" : {
                          "properties" : {
                            "h" : {
                              "type" : "long"
                            },
                            "resize" : {
                              "type" : "string"
                            },
                            "w" : {
                              "type" : "long"
                            }
                          }
                        }
                      }
                    },
                    "source_status_id" : {
                      "type" : "long"
                    },
                    "source_status_id_str" : {
                      "type" : "string"
                    },
                    "type" : {
                      "type" : "string"
                    },
                    "url" : {
                      "type" : "string"
                    }
                  }
                },
                "urls" : {
                  "properties" : {
                    "display_url" : {
                      "type" : "string"
                    },
                    "expanded_url" : {
                      "type" : "string"
                    },
                    "indices" : {
                      "type" : "long"
                    },
                    "url" : {
                      "type" : "string"
                    }
                  }
                },
                "user_mentions" : {
                  "properties" : {
                    "id" : {
                      "type" : "long"
                    },
                    "id_str" : {
                      "type" : "string"
                    },
                    "indices" : {
                      "type" : "long"
                    },
                    "name" : {
                      "type" : "string"
                    },
                    "screen_name" : {
                      "type" : "string"
                    }
                  }
                }
              }
            },
            "favorite_count" : {
              "type" : "long"
            },
            "favorited" : {
              "type" : "boolean"
            },
            "geo" : {
              "properties" : {
                "coordinates" : {
                  "type" : "double"
                },
                "type" : {
                  "type" : "string"
                }
              }
            },
            "id" : {
              "type" : "long"
            },
            "id_str" : {
              "type" : "string"
            },
            "in_reply_to_screen_name" : {
              "type" : "string"
            },
            "in_reply_to_status_id" : {
              "type" : "long"
            },
            "in_reply_to_status_id_str" : {
              "type" : "string"
            },
            "in_reply_to_user_id" : {
              "type" : "long"
            },
            "in_reply_to_user_id_str" : {
              "type" : "string"
            },
            "lang" : {
              "type" : "string"
            },
            "place" : {
              "properties" : {
                "attributes" : {
                  "type" : "object"
                },
                "bounding_box" : {
                  "properties" : {
                    "coordinates" : {
                      "type" : "double"
                    },
                    "type" : {
                      "type" : "string"
                    }
                  }
                },
                "country" : {
                  "type" : "string"
                },
                "country_code" : {
                  "type" : "string"
                },
                "full_name" : {
                  "type" : "string"
                },
                "id" : {
                  "type" : "string"
                },
                "name" : {
                  "type" : "string"
                },
                "place_type" : {
                  "type" : "string"
                },
                "url" : {
                  "type" : "string"
                }
              }
            },
            "possibly_sensitive" : {
              "type" : "boolean"
            },
            "retweet_count" : {
              "type" : "long"
            },
            "retweeted" : {
              "type" : "boolean"
            },
            "source" : {
              "type" : "string"
            },
            "text" : {
              "type" : "string"
            },
            "truncated" : {
              "type" : "boolean"
            },
            "user" : {
              "properties" : {
                "contributors_enabled" : {
                  "type" : "boolean"
                },
                "created_at" : {
                  "type" : "date", "format" : "E MMM d HH:mm:ss Z yyyy", "locale": "en_EN"
                },
                "default_profile" : {
                  "type" : "boolean"
                },
                "default_profile_image" : {
                  "type" : "boolean"
                },
                "description" : {
                  "type" : "string"
                },
                "favourites_count" : {
                  "type" : "long"
                },
                "followers_count" : {
                  "type" : "long"
                },
                "friends_count" : {
                  "type" : "long"
                },
                "geo_enabled" : {
                  "type" : "boolean"
                },
                "id" : {
                  "type" : "long"
                },
                "id_str" : {
                  "type" : "string"
                },
                "is_translator" : {
                  "type" : "boolean"
                },
                "lang" : {
                  "type" : "string"
                },
                "listed_count" : {
                  "type" : "long"
                },
                "location" : {
                  "type" : "string"
                },
                "name" : {
                  "type" : "string"
                },
                "profile_background_color" : {
                  "type" : "string"
                },
                "profile_background_image_url" : {
                  "type" : "string"
                },
                "profile_background_image_url_https" : {
                  "type" : "string"
                },
                "profile_background_tile" : {
                  "type" : "boolean"
                },
                "profile_banner_url" : {
                  "type" : "string"
                },
                "profile_image_url" : {
                  "type" : "string"
                },
                "profile_image_url_https" : {
                  "type" : "string"
                },
                "profile_link_color" : {
                  "type" : "string"
                },
                "profile_sidebar_border_color" : {
                  "type" : "string"
                },
                "profile_sidebar_fill_color" : {
                  "type" : "string"
                },
                "profile_text_color" : {
                  "type" : "string"
                },
                "profile_use_background_image" : {
                  "type" : "boolean"
                },
                "protected" : {
                  "type" : "boolean"
                },
                "screen_name" : {
                  "type" : "string"
                },
                "statuses_count" : {
                  "type" : "long"
                },
                "time_zone" : {
                  "type" : "string"
                },
                "url" : {
                  "type" : "string"
                },
                "utc_offset" : {
                  "type" : "long"
                },
                "verified" : {
                  "type" : "boolean"
                }
              }
            }
          }
        },
        "source" : {
          "type" : "string"
        },
        "text" : {
          "type" : "string"
        },
        "truncated" : {
          "type" : "boolean"
        },
        "user" : {
          "properties" : {
            "contributors_enabled" : {
              "type" : "boolean"
            },
            "created_at" : {
              "type" : "date", "format" : "E MMM d HH:mm:ss Z yyyy", "locale": "en_EN"
            },
            "default_profile" : {
              "type" : "boolean"
            },
            "default_profile_image" : {
              "type" : "boolean"
            },
            "description" : {
              "type" : "string"
            },
            "favourites_count" : {
              "type" : "long"
            },
            "followers_count" : {
              "type" : "long"
            },
            "friends_count" : {
              "type" : "long"
            },
            "geo_enabled" : {
              "type" : "boolean"
            },
            "id" : {
              "type" : "long"
            },
            "id_str" : {
              "type" : "string"
            },
            "is_translator" : {
              "type" : "boolean"
            },
            "lang" : {
              "type" : "string"
            },
            "listed_count" : {
              "type" : "long"
            },
            "location" : {
              "type" : "string"
            },
            "name" : {
              "type" : "string"
            },
            "profile_background_color" : {
              "type" : "string"
            },
            "profile_background_image_url" : {
              "type" : "string"
            },
            "profile_background_image_url_https" : {
              "type" : "string"
            },
            "profile_background_tile" : {
              "type" : "boolean"
            },
            "profile_banner_url" : {
              "type" : "string"
            },
            "profile_image_url" : {
              "type" : "string"
            },
            "profile_image_url_https" : {
              "type" : "string"
            },
            "profile_link_color" : {
              "type" : "string"
            },
            "profile_sidebar_border_color" : {
              "type" : "string"
            },
            "profile_sidebar_fill_color" : {
              "type" : "string"
            },
            "profile_text_color" : {
              "type" : "string"
            },
            "profile_use_background_image" : {
              "type" : "boolean"
            },
            "protected" : {
              "type" : "boolean"
            },
            "screen_name" : {
              "type" : "string"
            },
            "statuses_count" : {
              "type" : "long"
            },
            "time_zone" : {
              "type" : "string"
            },
            "url" : {
              "type" : "string"
            },
            "utc_offset" : {
              "type" : "long"
            },
            "verified" : {
              "type" : "boolean"
            }
          }
        }
      }
    }
}'; echo