neo4j-elasticsearch
neo4j-elasticsearch copied to clipboard
Allow for basic mapping of types in ES on index creation
It's really cool that this plugin defines mapping on index creation, however in some cases it doesn't always work to your advantage due to lack of mapping definitions in the properties.
ES assumes type cohesion where say <id:5> n.vin = "57784930" and <id:9> n.vin = "XX349494", if on first passing the vin with only numbers, even though should be a string, ES will map the type to long.
...
"mappings": {
"Vehicle": {
"properties": {
"id": {
"type": "string"
},
"vin": {
"type": "long"
},
"labels": {
"type": "string"
}
"uuid": {
"type": "string"
}
}
}
} ...
A suggestion would be to enforce types, therefore sending a mapping with the type, then letting ES detect the others, a suggestion could be:
elasticsearch.index_spec=vehicles:Vehicle(uuid,vin(type:string),sale_class), ...
However the better option would be to allow the full definitions of the mapping allowing for things like not-analyzed and custom tokenizers etc.
A potential (haven't tried this out yet) workaround is to use ES PUT mapping definition after the index/mapping is created, and then re-index everything.
So it would make sense to have a full index definition json file to refer to?
elasticsearch.index_file=elasticsearch_index.json ?
Do you think you could help us by providing a PR ?
Ping @alank64
Does it now support using a full index definition JSON file?
I am also interested in this. Currently all of my fields are being mapped as keyword which doesn't allow more specific querying of the index. I also tried updating the mapping with ES PUT after the creation, but I got an error resource_already_exists_exception