# Set document field as a mandatory

**URL:** <https://discuss.elastic.co/t/set-document-field-as-a-mandatory/6975>\
**Category:** Elasticsearch\
**Created:** [March 13, 2012, 1:18pm UTC](https://discuss.elastic.co/t/set-document-field-as-a-mandatory/6975 "2012-03-13T13:18:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [March 13, 2012, 1:18pm UTC](https://discuss.elastic.co/t/set-document-field-as-a-mandatory/6975/1 "2012-03-13T13:18:49Z")

</div>

Hi,

is it possible to set document field as a mandatory? So something like  
opposite of "null\_value" mapping. If the document does not have that field  
or it is null, do not index it and fire error.  
I think this can be useful integrity constrain.

Regards,  
Lukas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 14, 2012, 12:07pm UTC](https://discuss.elastic.co/t/set-document-field-as-a-mandatory/6975/2 "2012-03-14T12:07:20Z")

</div>

No, there isn't an option to do so.

On Tuesday, March 13, 2012 at 3:18 PM, Lukáš Vlček wrote:

> Hi,
> 
> is it possible to set document field as a mandatory? So something like opposite of "null\_value" mapping. If the document does not have that field or it is null, do not index it and fire error.  
> I think this can be useful integrity constrain.
> 
> Regards,  
> Lukas

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:36am UTC](https://discuss.elastic.co/t/set-document-field-as-a-mandatory/6975/3 "2017-07-06T03:36:14Z")

</div>


