Here's an example of the raw JSON of the documents:
{
"user_uuid": 1234,
"keywords": "apple",
"@timestamp": "2020-01-15",
},
{
"user_uuid": 1234,
"keywords": "google",
"@timestamp": "2020-01-21",
},
{
"user_uuid": 9876,
"keywords": "youtube",
"@timestamp": "2020-01-25",
}
The query I am trying is mentioned above. Simple example query can be:
POST _search
{
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{ "term" : { "keywords" : "google" } },
{ "term" : { "keywords" : "microsoft" } },
{ "term" : { "keywords" : "tesla" } }
],
"minimum_should_match": 1
}},
{"bool": {
"should": [
{ "term" : { "keywords" : "apple" } },
{ "term" : { "keywords" : "youtube" } },
{ "term" : { "keywords" : "spotify" } }
],
"minimum_should_match": 1
}}
]
}
},
"aggs": {
"uniq_uuids": {
"terms": {
"field": "user_uuid.keyword",
"size": 10000
}
}
}
}
what I am trying to find is the user_uuid which satisfies both the bool conditions. In this case, the user_uuid 1234. please let me know if I have not described the problem correctly.