0
{
    "size": 0,
    "query": {
        "bool": {
            "must": [
             {
                 "match": {
                     "cid": {
                         "query": "AFM"
                     }
                 }
             },
                {
                    "match": {
                        "web_code": "P" 
                    }
                }
            ],
            "filter": [
                {
                     
                    "not": {  // "type": "parsing_exception","reason": "unknown query [not]"
                        "term": {
                            "web_code": "PS"
                        }
                    }
                    
                }
            ]
        }
    }
 }
Val
  • 207,596
  • 13
  • 358
  • 360
Ajay Takur
  • 6,079
  • 5
  • 39
  • 55

1 Answers1

1

You simply need to use the bool/must_not query:

{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "cid": {
              "query": "AFM"
            }
          }
        },
        {
          "match": {
            "web_code.keyword": "P"
          }
        }
      ],
      "must_not": [
        {
          "term": {
            "web_code.keyword": "PS"
          }
        }
      ]
    }
  }
}
Val
  • 207,596
  • 13
  • 358
  • 360