How to edit a ES query in JAVA


(joker) #1

Can we edit a ES query in jAVA ? like removing some condition, modifying it, etc.

Thanks.


(David Pilato) #2

I don't understand. What kind of "query" are you thinking about?
May be share some code/examples with what you have in mind.


(joker) #3

I have a already build query(ie. a variable of type QueryBuilder) now I want to edit this query, to be precise this query has 3 "must" conditions and I want one of those mus to be removed from query. But in general is there way to edit a query after it has been build or like change order of conditions, etc. I googled but didn't find anything related.

PS : I think user should be given full ability to control query even after it has been build, right ? UPDATE : I think I was wrong.

Thanks.


(David Pilato) #4

I don't think you can.

You should just not add the must condition you want in the first place.


(joker) #5

Yeah, but I am working on existing codebase and solving a bug requires this thing. Thanks, for help though.


(joker) #6

So, I removed unwanted must field and taking this new query as skeleton and than modifying this query by copying first into another QueryBuilder variable(I assign as QueryBuilder newQuery = oldQuery; than modify newQuery) but it is getting copied as refrence, any idea why so ?


(system) #7

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