is possible index part of object in elasticsearch
?
example:
$ curl -xput 'http://localhost:9200/test/item/1' -d ' { "record": { "city": "london", "contact": "some person name" } } $ curl -xput 'http://localhost:9200/test/item/2' -d ' { "record": { "city": "london", "contact": { "phone": "some-phone-number", "name": "other person's name" } } } $ curl -xput 'http://localhost:9200/test/item/3' -d ' { "record": { "city": "oslo", "headquarters": { "phone": "some-other-phone-number", "address": "some address" } } }
i want city name searchable, remaining part of object want leave unindexed , arbitrary. example fields can change it's type object object. possible write mapping allow such behaviour?
update
my final solution looks this:
{ "test": { "dynamic": "false", "properties": { "name": { "type": "string" } } } }
i add "dynamic": "false" on lowest level of mapping , works expected.
you can achieve disabling dynamic mapping on entire type or inner object record:
"mappings": { "doc": { "properties": { "record": { "type": "object", "properties": { "city": {"type": "string"} }, "dynamic": false } } } }
Comments
Post a Comment