Elasticsearch映射未创建(Elasticsearch mapping not created)
我正尝试从官方ES指南创建一个索引。
索引创建时的状态为200,但它没有映射,如下图所示。 调用http:// localhost:9201 / test / _mapping / type1的GET返回404 Not Found。
我在端口9201上本地运行Elasticsearch 5.6.6,并使用Fiddler 4执行查询。
我错过了什么?
I am trying to create an index from the official ES guide.
The index is created with status 200, but it has no mapping as you can see in the picture below. Calling a GET for http://localhost:9201/test/_mapping/type1 returns 404 Not Found.
I am running Elasticsearch 5.6.6 locally on port 9201 and for the query execution I use Fiddler 4.
What am I missing ?
原文:https://stackoverflow.com/questions/48850942
最满意答案
你会想要使用Calender Class
public static Calendar convertToGmt(Calendar cal) { Date date = cal.getTime(); TimeZone tz = cal.getTimeZone(); log.debug("input calendar has date [" + date + "]"); //Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT long msFromEpochGmt = date.getTime(); //gives you the current offset in ms from GMT at the current date int offsetFromUTC = tz.getOffset(msFromEpochGmt); log.debug("offset is " + offsetFromUTC); //create a new calendar in GMT timezone, set to this date and add the offset Calendar gmtCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); gmtCal.setTime(date); gmtCal.add(Calendar.MILLISECOND, offsetFromUTC); log.debug("Created GMT cal with date [" + gmtCal.getTime() + "]"); return gmtCal; }
从这里开始
You'll want to use the Calender Class
public static Calendar convertToGmt(Calendar cal) { Date date = cal.getTime(); TimeZone tz = cal.getTimeZone(); log.debug("input calendar has date [" + date + "]"); //Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT long msFromEpochGmt = date.getTime(); //gives you the current offset in ms from GMT at the current date int offsetFromUTC = tz.getOffset(msFromEpochGmt); log.debug("offset is " + offsetFromUTC); //create a new calendar in GMT timezone, set to this date and add the offset Calendar gmtCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); gmtCal.setTime(date); gmtCal.add(Calendar.MILLISECOND, offsetFromUTC); log.debug("Created GMT cal with date [" + gmtCal.getTime() + "]"); return gmtCal; }
Taken from here
相关问答
更多-
您可以使用格式为"MMM dd, yyyy HH:mm:ss z (zXXX)" public static String getFormattedLicenseDate(long date) { SimpleDateFormat format = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss z (zXXX)"); return format.format(new Date(date)); } You can use SimpleDateForm ...
-
Laravel 5.3 - Carbon Date - UTC偏移获取时区名称(Laravel 5.3 - Carbon Date - UTC offset get timezone name)[2022-03-19]
这对我有用: $now = Carbon::now(-5); echo $now->timezone; // prints 'America/Chicago' Tried updating Carbon to no evail ended up using the old datetime class. $timezone = timezone_name_from_abbr(null, $utcOffset * 3600, TRUE); $dateTime = new DateTime(); $date ... -
你会想要使用Calender Class public static Calendar convertToGmt(Calendar cal) { Date date = cal.getTime(); TimeZone tz = cal.getTimeZone(); log.debug("input calendar has date [" + date + "]"); //Returns the number of milliseconds since January ...
-
转换时日期不同(Date is different when converted)[2021-07-14]
mdY不是解析的有效格式。 只有你们美国人认为将这些元素置于一个未按顺序排列是明智的...... 无论如何,重点是,06-01-2013是什么意思? 是6月1日还是1月6日? 为了保持一致性,计算机假定1月6日(dmY格式)。 我强烈建议使用Ymd H:i:s格式,因为它完全是big-endian,因此它本身可以作为字符串排序。 编辑:应该注意,您可以使用time()来获取当前时间戳。 m-d-Y is NOT a valid format for parsing. Only you Americans t ... -
该代码很好。 Java会自动将冬令时或夏令时考虑在内。 您也可以通过使用DateFormat对象将日期转换为字符串,在DateFormat对象上设置所需的时区: Date date = new Date(); DateFormat df = new SimpleDateFormat("HH:mm:ss"); // Tell the DateFormat that you want the time in this timezone df.setTimeZone(TimeZone.getTimeZone( ...
-
尼基 你不需要Zend_Date,因为PHP内部DateTime和DateTimeZone对象适用于此; 但是,如果你真的需要使用Zend_Date,我可以指出你正确的方向。 请参阅以下示例 $ date = new Zend_Date(1234567890,false,$ locale); $ date-> toString ...(有关详细信息,请参阅: http : //framework.zend.com/manual/en/zend.date.constants.html ) 对ISO 8601使 ...
-
带有自定义偏移的PHP默认时区(或日期)使用日期()(PHP Default Timezone (or Date) with Custom Offset Using date())[2022-03-04]
-new Date().getTimezoneOffset()/60; getTimezoneOffset()将从GMT中减去你的时间并返回分钟数。 因此,如果你住在GMT-8,它将返回480.要把它分成几小时,除以60.另外,注意标志与你需要的相反 - 它计算GMT与你的时区的偏差,而不是你的时区与GMT的偏差。 要解决这个问题,只需乘以-1即可。 就地理位置而言,我在几个项目中使用了MaxMind GeoIP并且运行良好,但我不确定它们是否提供时区数据。 这是您支付的服务,它们每月为您的数据库提供更新 ... -
NSDate表示连续时间中的一个点,它与时区或区域无关。 在一个时区看这个日期是当时的一个“视角”(即“我们在时间连续体中那个时候称为什么?”)。 如果您的目标是在当前时区显示时间,请查看NSDateFormatter: https : //developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/ - 您可以设置时间-zone(和区域设置,如果你想要的话)在格 ...
-
如果是没有时区的时间戳,则需要先告诉它使用UTC时区,然后转换为另一个时区: SELECT '1-1-2014 02:00:00'::timestamp at time zone 'UTC' at time zone 'America/Los_Angeles'; timezone --------------------- 2013-12-31 18:00:00 If it is timestamp without time zone you need first to tel ...
-
UTC日期转换为当地时区(UTC date convert to local timezone)[2021-08-13]
既然你有标记的moment ,我假设你正在使用时刻。 在这种情况下,您应该保持您的方法一致,而不是混合时刻和日期对象。 var dateStr = '2016-10-12 05:03:51'; var timeZone = "+0530"; var date = moment.utc(dateStr).utcOffset(dateStr + timeZone) console.log(date.toString()) Since you have tagged moment, I'm assuming ...