java - Elasticsearch - do not map the fields by default -
while indexing document, elasticsearch automatically create mapping missing fields (inside document)
is possible configure (or) there configuration can instruct elasticsearch not create missing fields, instead ignore.
basically, use java pojo, use instance of same pojo index document (by converting instance json using gson library) , use of fields in pojo external purpose.
so when set fields used external purpose, send document elasticsearch, these additional fields saved. want avoid that.
yes, possible disable dynamic mapping feature within elasticsearch mappings not created dynamically when new fields ingested. documentation:
dynamic mapping
when elasticsearch encounters unknown field in document, uses dynamic mapping determine datatype field , automatically adds new field type mapping.
sometimes desired behaviour , isn’t. perhaps don’t know fields added documents later on, want them indexed automatically. perhaps want ignore them. or — especially if using elasticsearch primary datastore — perhaps want unknown fields throw exception alert problem.
fortunately, can control behaviour dynamic setting, accepts following options:
true - add new fields dynamically — the default
false - ignore new fields
strict - throw exception if unknown field encountered
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/dynamic-mapping.html
Comments
Post a Comment