Skip to content

Verbatim() not working #2049

Closed
Closed
@mamasselin

Description

@mamasselin

NEST/Elasticsearch.Net version: 2.2.0

Elasticsearch version: 2.2.0

Description of the problem including expected versus actual behavior:

Using a MustNot bool query, i'm trying to filter out records where a string field (not analyzed) exists, but is empty ("").

.Bool(b => b.MustNot(mn  => mn.Verbatim().Term(t => t.Field(x => x.MyField).Value(""))))

This erases the whole boolean query from the JSON sent to ElasticSearch, event though I have Verbatim specified.

When putting any value other than empty string, it shows up in the JSON

EDIT:
As a workaround, I use Raw() and it does work:

.Bool(b =>b.MustNot(mn => mn.Raw("{\"query\": {\"term\": {\"myField\": {\"value\": \"\"}}}}")))

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