Can I create a field in a mapping that will be indexed with some default value if that field is not present in the document being indexed?
In other words, if I have a mapping with the field {"Rating": "integer"}, and then I index a document that does not include this field, can I have the field "Rating" be indexed, for example, with a value of zero?
I don't think null_value does what I want (unless I don't understand the documentation). Here is precisely what I want to do. I want to create an index with the following mapping:
I think that the only way to do something like that is using an ingest pipeline with some processors that would add the field if it does not exist.
It is not the cleanest way as it depends on the number of fields you want to add, but it works. You could create an ingest pipeline, configure your template to use this pipeline as the index.final_pipeline and then add some set processors with conditionals to check if the field exists.
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.