Plugin Query support through Nest C# client

Hi,

I am trying to execute the following query from the gas filter neo4j example in 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
}
}

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.

Thanks Russ for the response. :slight_smile:

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