My Index definition:
PUT /test-index
{
"mappings": {
"properties": {
"category":{
"type": "text",
"similarity": "boolean",
"term_vector": "with_positions_offsets",
"fields":{
"facet":{
"type": "keyword"
}
},
"copy_to": "test"
},
"keywords":{
"type": "text",
"similarity": "boolean",
"term_vector": "with_positions_offsets",
"fields":{
"facet":{
"type": "keyword"
}
},
"copy_to": "test"
},
"test":{
"type": "text",
"similarity": "boolean",
"term_vector": "with_positions_offsets",
"fields":{
"facet":{
"type": "keyword"
}
}
}
}
}
}
documents:
PUT /test-index/_doc/1
{
"category": ["ABC","123","hgh6"],
"keywords": "XYZ"
}
PUT /test-index/_doc/2
{
"category": ["XYZ","ABC","hgh7"],
"keywords": "XYZ"
}
PUT /test-index/_doc/3
{
"category": ["XYZ","ABC","hgh7"],
"keywords": "uuu"
}
Search Query:
GET test-index/_search
{
"query": {
"match_all": {}
},
"fields": [
"test"
]
}
Output:
My question is,
how to avoid duplicate values in the field "test"? I want it behave as a set instead of list.
Thank you in advance