-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
I have seen this question asked at least one other place with no good answer yet.... When trying to create a Query from a JSON string (in my case, I am trying to create an Object-Agnostic Percolator Proxy microservice and I need to be able to pass everything in as JSON strings), using the Raw function inside the query doesn't actually populate the query.
The code I am trying to run is this:
var percolateResponse = client.RegisterPercolator(query
.Name, p=>p
.Index(index.ActualName)
.Query(q=>q.Raw(query.Context)));
and the JSON that I have tried using for this is:
{"query":
{"term":
{"banana":
{"value": "green"}
}
}
}
and
{"term":
{"banana":
{"value": "green"}
}
}
and
{"banana":
{"value": "green"}
}
And nothing seems to actually populate the Query of the RegisterPercolatorRequest and this then wipes out whatever query I had indexed already. I have seen another question where someone just had problems in a general query using this as well. It did the same thing as mine, the query JSON was empty instead of using the raw JSON string to populate the query like we would expect it would.
Are we just doing this wrong, or does that functionality actually not work like that? And if that is the case, how do we do something like pass a Query into the RegisterPercolator via a JSON query if not the above?
Just for reference, the specific error I am getting is this:
[<indexName>] failed to parse query [<queryName>]];
nested: QueryParsingException[[<indexName>] [_na] query malformed, no field after start_object