I'm building a search application with Elastic Search. I am planning to use Angular to send queries to the application using Angular's $http.get function and the elastic search URL query. So to get all records where the field userID = 1, I would query:
Set angular $http.get variable to:
elasticsearch:9200/application/_search?q=userID:1
This works fine, however things get awkward when I want include other Bool searches within the same query.
So, if I want to query for all records where the userID = 1 AND userName = person that do not contain the word "hello", I build the Angular $http.get to be:
elasticsearch:9200/application/_search?q=!Content:hello&userID:1&userName:person&default_operator=AND
But this does not return the desired output.
I think this is an issue with the first expression being a NOT search, which seems to set the whole query to a NOT query, rather than (NOT Content hello) AND (userID = 1) AND (username = person) which is what I want to find.
The documentation on elasticsearch for using the URL query is limited and I cant find anything about how to build up this kind of search.
Should I be using a propper DSL from the elasticsearch java client and not using the URL query at all?