_id field missing from the mapping?

Hey all,

I stumbled upon an issue with elasticsearch indexing couchdb documents: _id
field is indexed, but not added to the mapping, and hence the _all field,
so if I do a query_string search, I have to specifically use the _id:XXX123
to find the specific document. I am most likely missing something obvious.
Here's the mapping I am submitting to elasticsearch:

{"sp-type":{
    "properties":{
        "_id":{
            "store":"yes",
            "type":"string",
            "index":"not_analyzed"
        },
        "_rev":{
            "type":"string",
            "index":"not_analyzed"
        },
        "title":{
            "type":"string",
            "index":"not_analyzed"
        },
        "code":{
            "type":"string",
            "index":"not_analyzed"
        },
        "description":{
            "type":"string",
            "index":"not_analyzed"
        },
        "dataPriority":{
            "type":"long"
        },
        "specificationPriority":{
            "type":"long"
        },
        "mediaPriority":{
            "type":"long"
        }
    }
}}

and this is what's being returned when I look up the index metadata through
elasticsearch-head:

{
    "state":"open",
    "settings":{
        "index.number_of_shards":5,
        "index.number_of_replicas":1,
        "index.version.created":200001
    },
    "mappings":{
        "sp-type":{
            "properties":{
                "_rev":{
                    "index":"not_analyzed",
                    "type":"string"
                },
                "title":{
                    "index":"not_analyzed",
                    "type":"string"
                },
                "specificationPriority":{
                    "type":"long"
                },
                "dataPriority":{
                    "type":"long"
                },
                "description":{
                    "index":"not_analyzed",
                    "type":"string"
                },
                "code":{
                    "index":"not_analyzed",
                    "type":"string"
                },
                "mediaPriority":{
                    "type":"long"
                }
            }
        }
    },
    "aliases":[ ]
}

Perhaps I am specifying in the wrong level of the mapping document?
Essentially, I would be happy if the _id field would somehow make it into
the _all field.

regards,
Andrius Juozapaitis

You are not placing the _id mapping in the correct place, it should be on
the same level as the top most properties, and not within properties, see
more here:
Elasticsearch Platform — Find real-time answers at scale | Elastic.

On Fri, Apr 6, 2012 at 10:15 PM, Andrius Juozapaitis andriusj@gmail.comwrote:

Hey all,

I stumbled upon an issue with elasticsearch indexing couchdb documents:
_id field is indexed, but not added to the mapping, and hence the _all
field, so if I do a query_string search, I have to specifically use the
_id:XXX123 to find the specific document. I am most likely missing
something obvious. Here's the mapping I am submitting to elasticsearch:

{"sp-type":{
>     "properties":{
>         "_id":{
>             "store":"yes",
>             "type":"string",
>             "index":"not_analyzed"
>         },
>         "_rev":{
>             "type":"string",
>             "index":"not_analyzed"
>         },
>         "title":{
>             "type":"string",
>             "index":"not_analyzed"
>         },
>         "code":{
>             "type":"string",
>             "index":"not_analyzed"
>         },
>         "description":{
>             "type":"string",
>             "index":"not_analyzed"
>         },
>         "dataPriority":{
>             "type":"long"
>         },
>         "specificationPriority":{
>             "type":"long"
>         },
>         "mediaPriority":{
>             "type":"long"
>         }
>     }
> }}

and this is what's being returned when I look up the index metadata
through elasticsearch-head:

{
>     "state":"open",
>     "settings":{
>         "index.number_of_shards":5,
>         "index.number_of_replicas":1,
>         "index.version.created":200001
>     },
>     "mappings":{
>         "sp-type":{
>             "properties":{
>                 "_rev":{
>                     "index":"not_analyzed",
>                     "type":"string"
>                 },
>                 "title":{
>                     "index":"not_analyzed",
>                     "type":"string"
>                 },
>                 "specificationPriority":{
>                     "type":"long"
>                 },
>                 "dataPriority":{
>                     "type":"long"
>                 },
>                 "description":{
>                     "index":"not_analyzed",
>                     "type":"string"
>                 },
>                 "code":{
>                     "index":"not_analyzed",
>                     "type":"string"
>                 },
>                 "mediaPriority":{
>                     "type":"long"
>                 }
>             }
>         }
>     },
>     "aliases":[ ]
> }

Perhaps I am specifying in the wrong level of the mapping document?
Essentially, I would be happy if the _id field would somehow make it into
the _all field.

regards,
Andrius Juozapaitis

And, you don't need to store it, you will always get the _id back from a
search request, so no need to explicitly ask for it. There is no option to
include the _id in all.

On Sat, Apr 7, 2012 at 6:20 PM, Shay Banon kimchy@gmail.com wrote:

You are not placing the _id mapping in the correct place, it should be on
the same level as the top most properties, and not within properties, see
more here:
Elasticsearch Platform — Find real-time answers at scale | Elastic.

On Fri, Apr 6, 2012 at 10:15 PM, Andrius Juozapaitis andriusj@gmail.comwrote:

Hey all,

I stumbled upon an issue with elasticsearch indexing couchdb documents:
_id field is indexed, but not added to the mapping, and hence the _all
field, so if I do a query_string search, I have to specifically use the
_id:XXX123 to find the specific document. I am most likely missing
something obvious. Here's the mapping I am submitting to elasticsearch:

{"sp-type":{
>>     "properties":{
>>         "_id":{
>>             "store":"yes",
>>             "type":"string",
>>             "index":"not_analyzed"
>>         },
>>         "_rev":{
>>             "type":"string",
>>             "index":"not_analyzed"
>>         },
>>         "title":{
>>             "type":"string",
>>             "index":"not_analyzed"
>>         },
>>         "code":{
>>             "type":"string",
>>             "index":"not_analyzed"
>>         },
>>         "description":{
>>             "type":"string",
>>             "index":"not_analyzed"
>>         },
>>         "dataPriority":{
>>             "type":"long"
>>         },
>>         "specificationPriority":{
>>             "type":"long"
>>         },
>>         "mediaPriority":{
>>             "type":"long"
>>         }
>>     }
>> }}

and this is what's being returned when I look up the index metadata
through elasticsearch-head:

{
>>     "state":"open",
>>     "settings":{
>>         "index.number_of_shards":5,
>>         "index.number_of_replicas":1,
>>         "index.version.created":200001
>>     },
>>     "mappings":{
>>         "sp-type":{
>>             "properties":{
>>                 "_rev":{
>>                     "index":"not_analyzed",
>>                     "type":"string"
>>                 },
>>                 "title":{
>>                     "index":"not_analyzed",
>>                     "type":"string"
>>                 },
>>                 "specificationPriority":{
>>                     "type":"long"
>>                 },
>>                 "dataPriority":{
>>                     "type":"long"
>>                 },
>>                 "description":{
>>                     "index":"not_analyzed",
>>                     "type":"string"
>>                 },
>>                 "code":{
>>                     "index":"not_analyzed",
>>                     "type":"string"
>>                 },
>>                 "mediaPriority":{
>>                     "type":"long"
>>                 }
>>             }
>>         }
>>     },
>>     "aliases":[ ]
>> }

Perhaps I am specifying in the wrong level of the mapping document?
Essentially, I would be happy if the _id field would somehow make it into
the _all field.

regards,
Andrius Juozapaitis

I guess nothing prevents me from simply adding the _id:querytext OR
(*:querytext) to compensate for that behavior.

Thanks,
Andrius

On Saturday, April 7, 2012 6:22:34 PM UTC+3, kimchy wrote:

And, you don't need to store it, you will always get the _id back from a
search request, so no need to explicitly ask for it. There is no option to
include the _id in all.

On Sat, Apr 7, 2012 at 6:20 PM, Shay Banon kimchy@gmail.com wrote:

You are not placing the _id mapping in the correct place, it should be on
the same level as the top most properties, and not within properties, see
more here:
Elasticsearch Platform — Find real-time answers at scale | Elastic.

On Fri, Apr 6, 2012 at 10:15 PM, Andrius Juozapaitis andriusj@gmail.comwrote:

Hey all,

I stumbled upon an issue with elasticsearch indexing couchdb documents:
_id field is indexed, but not added to the mapping, and hence the _all
field, so if I do a query_string search, I have to specifically use the
_id:XXX123 to find the specific document. I am most likely missing
something obvious. Here's the mapping I am submitting to elasticsearch:

{"sp-type":{
>>>     "properties":{
>>>         "_id":{
>>>             "store":"yes",
>>>             "type":"string",
>>>             "index":"not_analyzed"
>>>         },
>>>         "_rev":{
>>>             "type":"string",
>>>             "index":"not_analyzed"
>>>         },
>>>         "title":{
>>>             "type":"string",
>>>             "index":"not_analyzed"
>>>         },
>>>         "code":{
>>>             "type":"string",
>>>             "index":"not_analyzed"
>>>         },
>>>         "description":{
>>>             "type":"string",
>>>             "index":"not_analyzed"
>>>         },
>>>         "dataPriority":{
>>>             "type":"long"
>>>         },
>>>         "specificationPriority":{
>>>             "type":"long"
>>>         },
>>>         "mediaPriority":{
>>>             "type":"long"
>>>         }
>>>     }
>>> }}

and this is what's being returned when I look up the index metadata
through elasticsearch-head:

{
>>>     "state":"open",
>>>     "settings":{
>>>         "index.number_of_shards":5,
>>>         "index.number_of_replicas":1,
>>>         "index.version.created":200001
>>>     },
>>>     "mappings":{
>>>         "sp-type":{
>>>             "properties":{
>>>                 "_rev":{
>>>                     "index":"not_analyzed",
>>>                     "type":"string"
>>>                 },
>>>                 "title":{
>>>                     "index":"not_analyzed",
>>>                     "type":"string"
>>>                 },
>>>                 "specificationPriority":{
>>>                     "type":"long"
>>>                 },
>>>                 "dataPriority":{
>>>                     "type":"long"
>>>                 },
>>>                 "description":{
>>>                     "index":"not_analyzed",
>>>                     "type":"string"
>>>                 },
>>>                 "code":{
>>>                     "index":"not_analyzed",
>>>                     "type":"string"
>>>                 },
>>>                 "mediaPriority":{
>>>                     "type":"long"
>>>                 }
>>>             }
>>>         }
>>>     },
>>>     "aliases":[ ]
>>> }

Perhaps I am specifying in the wrong level of the mapping document?
Essentially, I would be happy if the _id field would somehow make it into
the _all field.

regards,
Andrius Juozapaitis