querydsl - How to perform MINUS operation in elasticsearch -


i'm trying create minus query mysql (dataset1-dataset2) in elasticsearch using querydsl can't find way.

anyone show me way? tx in advance

you can use bool query must , must not.
documentation on bool query

you put query dataset1 in must , query dataset2 in must_not:

{ "bool" : {     "must" : {         dataset1     }     "must_not" : {         dataset2     } } 

}

for example:

{   "query": {     "filtered": {       "filter": {         "bool": {           "must": {             "range": {               "@timestamp": {                 "lte": 1467811620000,                 "gte": 1467811520000               }             }           },           "must_not": {             "term": {               "_type": "bus-api"             }           }         }       }     }   } } 

this return documents between 2 times, excluding of type bus-api.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -