ncb000gt / node-es

NodeJS module for ElasticSearch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mapping index not possible

randunel opened this issue · comments

In ES, one can setup the mapping with various index-related settings and multiple types, all in one request. This is not possible with node-es.

Eg:
curl -XPUT "http://localhost:9200/myindex" -d mapping.json

mapping.json:

{
    settings: {... analyzers, mapping type ...},
    mappings: {
        collection1: {... properties, routing ...},
        collection2: {...},
        collection3: {...}
    },
}

node-es forces a type to be specified everytime an index is specified with indices.putMapping, which reduces the generic ES api to a limited set. Is there a workaround?

Ok we're supposed to use .index, closed. It would be nice to not have to specify _type: "" when updating an index mapping, but we can probably live with that happily ever after :)

For future reference:

client.index( {
    _index: 'myindex',
    _type: '',
    create: false
}, mapping, callback);