# Plugin Query support through Nest C# client

**URL:** <https://discuss.elastic.co/t/plugin-query-support-through-nest-c-client/99489>\
**Category:** Elasticsearch\
**Created:** [September 5, 2017, 9:18pm UTC](https://discuss.elastic.co/t/plugin-query-support-through-nest-c-client/99489 "2017-09-05T21:18:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sayantan](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Sayantan](https://discuss.elastic.co/u/Sayantan)\
**Post date:** [September 5, 2017, 9:18pm UTC](https://discuss.elastic.co/t/plugin-query-support-through-nest-c-client/99489/1 "2017-09-05T21:18:48Z")

</div>

Hi,

I am trying to execute the following query from the gas filter neo4j example in [https://github.com/graphaware/graph-aided-search](https://github.com/graphaware/graph-aided-search). How to use the Nest DSL in forming the query below or do I have to send raw Json using the low level client.

{  
"query" : {  
"match\_all" : {}  
},  
"gas-filter" :{  
"name": "SearchResultCypherFilter",  
"query": "MATCH (cust:Customer)-[:PURCHASED]-\>(:Order)-[o:ORDERS]-\>(p:Product) WHERE cust.contactName = 'Maria Anders' RETURN DISTINCT p.productID as id;",  
"exclude": false  
}  
}

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [September 8, 2017, 7:49am UTC](https://discuss.elastic.co/t/plugin-query-support-through-nest-c-client/99489/2 "2017-09-08T07:49:43Z")

</div>

The high level NEST client won't be able to support that query, but you can use the low level client exposed on the high level client through the `.LowLevel` property for this

```
var query = @"{
  ""query"" : {
    ""match_all"" : {}
  },
  ""gas-filter"" :{
    ""name"": ""SearchResultCypherFilter"",
    ""query"": ""MATCH (cust:Customer)-[:PURCHASED]->(:Order)-[o:ORDERS]->(p:Product) WHERE cust.contactName = 'Maria Anders' RETURN DISTINCT p.productID as id;"",
    ""exclude"": false
  }
}";

var searchResponse = client.LowLevel.Search<SearchResponse<MyDocument>>(
    "index", 
    "type",
    query);

// will be SearchResponse<MyDocument>
var response = searchResponse.Body;

```

Nice thing about using the low level client on the high level client is that you can still return strongly typed responses.

---

<div class="post-metadata">

**Author:** ![Sayantan](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Sayantan](https://discuss.elastic.co/u/Sayantan)\
**Post date:** [September 10, 2017, 9:01pm UTC](https://discuss.elastic.co/t/plugin-query-support-through-nest-c-client/99489/3 "2017-09-10T21:01:09Z")

</div>

Thanks Russ for the response. 🙂

---

<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:** [October 8, 2017, 9:01pm UTC](https://discuss.elastic.co/t/plugin-query-support-through-nest-c-client/99489/4 "2017-10-08T21:01:11Z")

</div>

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