If you change your mind, you can always use the reindex API to reindex the documents with a new strategy for those fields. As you have the full _source, it will make your life easier.
Long story short: send the whole document to elasticsearch.
Thank you for the reply. I really appreciate it.
Would size of the document be an issue from a cost or performance perspective.
Also do i need to map all the fields in my document explicitly?
I understand elasticsearch will index all fields by default if an explicit mapping is not provided (dynamic mapping?). Is relying on that not recommended.
Yes. If you are storing things like BASE64 blobs, then it will have an impact (disk size and performance wise). It depends. What does a typical document would look like? Could you share that?
I do not recommend it. It's very good to begin with elasticsearch but at the end, you want to have more control on what is happening. You can define a dynamic template: see Dynamic templates | Elasticsearch Guide [8.11] | Elastic.
If all the optional fields are under another field like foo and bar under meta (meta.foo and meta.bar), then you can just disable meta object field and everything under will be ignored.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.