Mikhail, Thanks for your reply. This is was i tried..
PUT lp_data_index
{
"settings": { },
"mappings": {
"composite": {
"properties": {
"required_matches": {
"type": "long"
},
"data": {
"type": "keyword"
}
}
}
}
}
PUT lp_data_index/composite/1
{
"data": [
"cat",
"tiger"
],
"required_matches": 2
}
PUT lp_data_index/composite/2
{
"data": [
"cat"
],
"required_matches": 1
}
So, if search for
GET lp_data_index/composite/_search
{
"query": {
"terms_set": {
"data" : {
"terms" : ["cat"],
"minimum_should_match_field": "required_matches"
}
}
}
}
I'm getting 1 response, this is perfectly fine
"hits": {
"total": 1,
"max_score": 0.2876821,
"hits": [
{
"_index": "lp_data_index",
"_type": "composite",
"_id": "2",
"_score": 0.2876821,
"_source": {
"data": [
"cat"
],
"required_matches": 1
}
}
]
}
But when search for
GET lp_data_index/composite/_search
{
"query": {
"terms_set": {
"data" : {
"terms" : ["cat","tiger"],
"minimum_should_match_field": "required_matches"
}
}
}
}
Im getting both docs, but im expecting only one doc should be in result
"hits": {
"total": 2,
"max_score": 0.5753642,
"hits": [
{
"_index": "lp_data_index",
"_type": "composite",
"_id": "1",
"_score": 0.5753642,
"_source": {
"data": [
"cat",
"tiger"
],
"required_matches": 2
}
},
{
"_index": "lp_data_index",
"_type": "composite",
"_id": "2",
"_score": 0.2876821,
"_source": {
"data": [
"cat"
],
"required_matches": 1
}
}
]
}
So in second case also how to get exactly matching doc?