0
我試圖讓多值字段應該只存儲唯一值。 當我試圖使用部分更新(原子更新使用「添加」)添加值。 如果該值已經存在於多值字段中,則不應該增加值。如何在多值字段中添加/存儲唯一值?
For example:
<field name="name" type="text_general" indexed="true" stored="true" multiValued="true"/>
first adding values into field :
{"id":"36",
"name":["RAJEEV CHAUHAN","Alex"]
}
Now values in the "name" field are as follows"name":["RAJEEV CHAUHAN","Alex"].
second time when I add using partial update "add" as below,
{"id":"36",
"name":{"add":["RAJEEV CHAUHAN","Alex","ERICK"]}
}
Now the values in the field should be "name":["RAJEEV CHAUHAN","Alex","ERICK"], it should not be
"name":["RAJEEV CHAUHAN","Alex","RAJEEV CHAUHAN","Alex","ERICK"]
How can I achieve these functionality?
Thanks in advance