# NEST vs Elastic query inconsistency

**URL:** <https://discuss.elastic.co/t/nest-vs-elastic-query-inconsistency/290282>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [November 26, 2021, 12:22pm UTC](https://discuss.elastic.co/t/nest-vs-elastic-query-inconsistency/290282 "2021-11-26T12:22:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Perrow](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@Perrow](https://discuss.elastic.co/u/Perrow)\
**Post date:** [November 26, 2021, 12:22pm UTC](https://discuss.elastic.co/t/nest-vs-elastic-query-inconsistency/290282/1 "2021-11-26T12:22:48Z")

</div>

I'm updating an application that used Elastic 1.6 to version 7.15. I've gotten indexing to work and some searching but for some reason filters aren't working. The queries are built dynamically and I think I've managed to translate the classes used to the new ones as needed.

When I inspect the elements in the SearchRequest object before executing the search it looks alright and looking at the reply (DebugInformation) the filter query looks alright, but the filter section logged by Elastic is missing field names. The query part is still correct.

Filter section as Nest/DebugInformation reports it:

```auto
"filter": [{
                    "bool": {
                        "must": [{
                                "bool": {
                                    "must_not": [{
                                            "range": {
                                                "startPublish": {
                                                    "gte": "2021-11-26T11:28:41"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }, {
                                "bool": {
                                    "must_not": [{
                                            "range": {
                                                "stopPublish": {
                                                    "lte": "2021-11-26T11:28:41"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }, {
                                "bool": {
                                    "should": [{
                                            "bool": {
                                                "must_not": [{
                                                        "terms": {
                                                            "_type": ["EventPageIndexEntity"]
                                                        }
                                                    }
                                                ]
                                            }
                                        }, {
                                            "range": {
                                                "to": {
                                                    "gte": "2021-11-26T11:28:00",
                                                    "lt": "9999-12-31T23:59:59"
                                                }
                                            }
                                        }
                                    ]
                                }
                            }, {
                                "terms": {
                                    "acl": ["Intranet", "Everyone"]
                                }
                            }
                        ]
                    }
                }
            ]

```

Same section as Elastic logs it:

```auto
"filter": [{
                    "bool": {
                        "must": [{
                                "bool": {
                                    "must_not": [{
                                            "match_none": {
                                                "boost": 1.0
                                            }
                                        }
                                    ],
                                    "adjust_pure_negative": true,
                                    "boost": 1.0
                                }
                            }, {
                                "bool": {
                                    "must_not": [{
                                            "match_none": {
                                                "boost": 1.0
                                            }
                                        }
                                    ],
                                    "adjust_pure_negative": true,
                                    "boost": 1.0
                                }
                            }, {
                                "bool": {
                                    "should": [{
                                            "bool": {
                                                "must_not": [{
                                                        "match_none": {
                                                            "boost": 1.0
                                                        }
                                                    }
                                                ],
                                                "adjust_pure_negative": true,
                                                "boost": 1.0
                                            }
                                        }, {
                                            "match_none": {
                                                "boost": 1.0
                                            }
                                        }
                                    ],
                                    "adjust_pure_negative": true,
                                    "boost": 1.0
                                }
                            }, {
                                "terms": {
                                    "acl": ["Intranet", "Everyone"],
                                    "boost": 1.0
                                }
                            }
                        ],
                        "adjust_pure_negative": true,
                        "boost": 1.0
                    }
                }
            ]

```

The field names are gone, where does adjust\_pure\_negative and match\_none come from and how can I make it work?

---

<div class="post-metadata">

**Author:** ![Perrow](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@Perrow](https://discuss.elastic.co/u/Perrow)\
**Post date:** [November 26, 2021, 2:03pm UTC](https://discuss.elastic.co/t/nest-vs-elastic-query-inconsistency/290282/2 "2021-11-26T14:03:19Z")

</div>

Ok, so new developments.

1. Upgraded Newtonsoft.Json which was a few major versions behind but no change. Think I've read somewhere that the latest Nest versions uses a built in Json converter but thought I'd try this anyway.

2. Posted the Nest/DebugInformation reported Json to Elastic using Postman which worked, no issues, no rewrite of the query in the Elastic logs. I'm now guessing that the query in DebugInformation isnt't what's actually sent to the server.

Still no clue how to fix though.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 24, 2021, 2:04pm UTC](https://discuss.elastic.co/t/nest-vs-elastic-query-inconsistency/290282/3 "2021-12-24T14:04:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
