What mapping or structure should I use for an index that will have very varying fields per document?

Hi there!

As per title; i'd like to have an index which will have very different fields per document. How should I approach this task? What does the mapping look like, if any.

Short example of what i'd like to acchieve:

Document 1:
{ "coolfield" : "smile", "foo" : "bar", "barry" : "omega" }

And document 2 (and so on) could look like:
{ "yes" : 1337, "cool" : false, "myCustomField" : "longtextvaluethatneedstobesearchable" }

I'm using Elastisearch version : 7.10.2

Is it possible for such an index to be created and also important; can i make these documents searchable? I would have a frontend that knows which fields the document has, and would supply the terms and query elasticsearch.

Currently Elasticsearch DOES seem to be able to do this, however it will create the new/custom fields for the entire index, which seems a bit much as there could be as many as a 1000 fields in the future with this setup/setting, where ideally it would not do this (however i'm unsure if i then would be able to search for these given fields/values)

Thanks in advance!

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