Update date field format mapping


(Matthias Götzke) #1

Since the format used in the mapping of a field also seems to be used for
interpreting query_string queries. Is it possible to update the format of a
mapped date field to include alternate representations ?

eg.

{
"person": {
"properties": {
"birthDate": {
"type": "date",
"format": "YYYYMMdd"
}
}
}
}

to

{
"person": {
"properties": {
"birthDate": {
"type": "date",
"format": "YYYYMMdd||dd.MM.yyyy"
}
}
}
}

Since this would not change the way data is parsed/stored etc it should not
require a re-index of any kind.

When trying to update a mapping this way though it returns { "ok":true,
"acknowledge":true} without doing anything.

On a related note, I see the query_string parser seems to use the
DateMathParser.java class. This class sadly uses hardcoded string for
specifiers such as w or y for week and year respectively. Any chance to
make this configurable ? Either globally or per request.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey Matthias,

I am not a hundred percent sure I got your questions, so let me try:

  1. You would like to change the date format on the fly if I got you right.
    I have a PR lying around for that, where I still need to sort some things
    out, see https://github.com/elasticsearch/elasticsearch/pull/3735 if you
    are interested. This also means, once a date format is set, you cannot
    change it at the moment.

  2. You lost me here. What exactly would you like to configure? The
    representation for week/year? Can you tell me a bit more about your
    use-case so I understand?

Thx and sorry for the confusion on my side.

--Alex

On Fri, Oct 11, 2013 at 1:31 PM, Matthias Götzke mgt576@gmail.com wrote:

Since the format used in the mapping of a field also seems to be used for
interpreting query_string queries. Is it possible to update the format of a
mapped date field to include alternate representations ?

eg.

{
"person": {
"properties": {
"birthDate": {
"type": "date",
"format": "YYYYMMdd"
}
}
}
}

to

{
"person": {
"properties": {
"birthDate": {
"type": "date",
"format": "YYYYMMdd||dd.MM.yyyy"
}
}
}
}

Since this would not change the way data is parsed/stored etc it should
not require a re-index of any kind.

When trying to update a mapping this way though it returns { "ok":true,
"acknowledge":true} without doing anything.

On a related note, I see the query_string parser seems to use the
DateMathParser.java class. This class sadly uses hardcoded string for
specifiers such as w or y for week and year respectively. Any chance to
make this configurable ? Either globally or per request.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Matthias Götzke) #3

Hi,

Will have a look the pr...

  1. the letters y m d etc are English abbreviations .. In other languages
    that would naturally be something else.

E.g 4/23/2013-1y is us English... In German it should be 23.4.2013-1j .. J
instead of y

Von meinem Windows Phone gesendet

From: Alexander Reelsen alr@spinscale.de
Sent: 14.10.2013 09:49
To: elasticsearch@googlegroups.com
Subject: Re: Update date field format mapping

Hey Matthias,

I am not a hundred percent sure I got your questions, so let me try:

  1. You would like to change the date format on the fly if I got you right.
    I have a PR lying around for that, where I still need to sort some things
    out, see https://github.com/elasticsearch/elasticsearch/pull/3735 if you
    are interested. This also means, once a date format is set, you cannot
    change it at the moment.

  2. You lost me here. What exactly would you like to configure? The
    representation for week/year? Can you tell me a bit more about your
    use-case so I understand?

Thx and sorry for the confusion on my side.

--Alex

On Fri, Oct 11, 2013 at 1:31 PM, Matthias Götzke mgt576@gmail.com wrote:

Since the format used in the mapping of a field also seems to be used for
interpreting query_string queries. Is it possible to update the format of a
mapped date field to include alternate representations ?

eg.

{
"person": {
"properties": {
"birthDate": {
"type": "date",
"format": "YYYYMMdd"
}
}
}
}

to

{
"person": {
"properties": {
"birthDate": {
"type": "date",
"format": "YYYYMMdd||dd.MM.yyyy"
}
}
}
}

Since this would not change the way data is parsed/stored etc it should
not require a re-index of any kind.

When trying to update a mapping this way though it returns { "ok":true,
"acknowledge":true} without doing anything.

On a related note, I see the query_string parser seems to use the
DateMathParser.java class. This class sadly uses hardcoded string for
specifiers such as w or y for week and year respectively. Any chance to
make this configurable ? Either globally or per request.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/cf_hTbj4MhM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4