Mapping for a hash map


(Manuel Vacelet-2) #1

Hi there,

I'd like to define a mapping for a hash map but I do not manage to get it
right.
Here is the kind of documents I'd like to index:
{
"message" : "Elasticsearch test 1",
"dates": {
"create": "2014-01-11",
"update": "2014-06-12"
}
}

{
"message" : "Elasticsearch test 2",
"dates": {
"date_1": "2014-01-11",
}
}

Note: date_1 is on purpose, I cannot know at mapping definition how many
dates I will have to deal with.

As is, without mapping it works automagically (probably thanks to type
autodetection) but is there a mean to get it done without ?

My problem is that I might have stuff like that too:
{
"message" : "Elasticsearch test 3",
"strings": {
"string_1": "some text",
"string_2": "2014-01-11"
}
}

{
"message" : "Elasticsearch test 4",
"strings": {
"string_2": "some other text"
}
}

In this case I need to be able to enforce that string_2 is not a date

What is the right way to do it ?
Manuel

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f45de373-4b57-4550-b9ae-c68d71dcf459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2