Sorry my bad, the structure is an array of objects. Not just an object. So now that its an array of objects or a null value. How can I accomplish this?
If there are no objects in the list, either omit the field completely or show it as an empty array. Null values only apply to fields that are indexed, which the root object is not. In the example above the fields in the array are indexed as custom_field.pid and custom_field.sharing_type. custom_field is part of the path but not indexed separately, so you can not set a null value for it.
Each field must have a mapping and can not be an object and allow a value at the same time. If you make custom_field any type except object it will be able to take a value but can no longer hold an array of objects as in your example.
That is why I am recommending either omitting it or setting it to an empty array as you can not assign a null value.
No, I do not think you can (could be wrong though). You may however be able to use a scripted or runtime field to check if the field is empty (may be slow) or you could instead check for the existence of any of the fields in the objects held in the array (if they all do not exist the array must be empty).
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.