Mapping recommendations

Hi, I have several question regarding ES mapping.

  1. Should all the fields of the document be included in the mapping? or only those that i will search on?
  2. Are fields without mapping even searchable? if they are, how much slower to search on those field compared to mapped ones?

Thanks

If you use dynamic mapping they will default to being searchable.

If you don't want that, use static mapping.

Thanks for your reply

So, correct me if i'm wrong, but the whole purpose of the mapping is to make the field searchable.
If i have fields that i don't to search on (only to retrieve them with the query) then there's no reason to create mapping for them, is that correct?

A field has to be mapped. In that mapping you can define it to be searchable or not.

If you don't explicitly map a field, and you don't have strict mapping set, then it will have a dynamic mapping applied to it which will make it searchable.

So either way it will be mapped.

OK, I get it now
Thank you!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.