Skip to content

IsVerbatim not working with multiple queries #1898

Closed
@EricKeij

Description

@EricKeij

Following up on #1872.

IsVerbatim works fine on a single TermQuery but i can't seem to get it to work when combining mutiple queries.

var container = new QueryContainer(new TermQuery
{
 Field = "surname",
 Value = ""
});

container &= new TermQuery
{
 Field = "age",
 Value = "10"
}

((IQueryContainer)container).IsVerbatim = true;
ElasticClient.Search<MyType>(new SearchRequest { Query = container });

This results in

POST /<index>/<type>/_search
{
   "query": {
      "term": {
         "age": {
            "value": "10"
          }
       }
    }
}

While I expect

POST /<index>/<type>/_search
{
   "query": {
      "bool": {
         "must": [
         {
            "term": {
               "surname": {
                "value": ""
             }
           }
         },
         {
            "term": {
                "age": {
                "value": "10"
                 }
             }
          }
       ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions