Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow query separation. Useful for complex queries. #3

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

karussell commented Jan 10, 2012

I know that this patch is not complete (probably it is not even useful) but I want to document it somewhere:

I want to be able to split my query via javascript in the "Any Request" Tab. Just to avoid bracket confusion of complex queries. The only problem now for me is that I need to use round brackets around every json:

q=({match_all:{}});
({query:q})

Anyone knows a workaround for this?

allow query separation. useful for complex queries. downside: you'll …
…need to use brackets around the json. q=({match_all:{}});({query:q})
Owner

mobz commented Jan 11, 2012

I'm not comfortable committing this patch as is, however I can see the functionality is useful. Using eval before JSON.stringify and wrapping your code in a self executing anonymous function should allow you to put arbitrarily complex javascript in the anyquery panel

(function() {
// anything in here
return { final object };
}())

Contributor

karussell commented Jan 11, 2012

I'm not comfortable committing this patch as is

yeah, I know. But you don't have an issues page :)

wrapping your code in a self executing anonymous function

cool. thanks, I'll try!

Contributor

karussell commented Jan 19, 2012

This works. But the only trick is to assign the last statement to a variable and then it would work even with my simple eval code (can you confirm this?):

q={match_all:{}}
anyvar = {query:q}

@mobz mobz closed this Feb 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment