Mapping differences between ES 1.7.3 and 2.0.0


(Carlos Terron) #1

I'm testing some queries in ES 2.0.0 to migrate a service running in 1.7.3. I have seen this behaviour in 2.0 If I create an index with this mapping in an 1.7.3 instance
> {
> "mensaje": {
> "properties": {
> "asunto": {
> "type": "string"
> },
> "mensaje":{
> "properties": {
> "titulo":{
> "type": "string"
> }
> }
> }
> }
> }
> }

I upload these data to the index with the bulk interface
{ "index": {"_index": "testmap", "_type": "mensaje", "_id": "1"}}
{"mensaje": {"titulo": "uno"}}
{ "index": {"_index": "testmap", "_type": "mensaje", "_id": "2"}}
{"mensaje": {"titulo": "dos"}}
{ "index": {"_index": "testmap", "_type": "mensaje", "_id": "3"}}
{"mensaje": {"titulo": "tres"}}
{ "index": {"_index": "testmap", "_type": "mensaje", "_id": "4"}}
{"mensaje": {"titulo": "cuatro"}}

And make this query against the Index

{
"query":{
"bool": {
"must": {
"term": {
"titulo":"uno"
}
}
}
}
}

Well, this query returns data in an 1.7.3 instance but returns nothing in a 2.0.0 instance. Looking for info, I have read that the mapping has been refactored in ES 2.0 , The Great Mapping Refactoring, and the previous query works with:

{
"query":{
"bool": {
"must": {
"term": {
"mensaje.titulo":"uno"
}
}
}
}
}
Is it necessary to qualify all fields in the map with a mapping like this. Is there any configuration parameter I can use to have the old behaviour?


(system) #2