I was trying to use the Java API to do bulk search, and this is the info I didn't hope for but that I expected : I can't do Java API-based bulk searches.
But I think I DID a bulk search using Sense, and another time with an ajax call from a web page (messy as hell, I know).
In Sense, for example:
POST elasticsearch/_msearch {"index":"index1","search_type":"count","ignore_unavailable":true} \n {"size":0,"timeout":0,"aggs":{"2":{"date_range":{"field":"field1","ranges":[{"from":"2016-05-01","to":"now"},{"to":"2016-05-01","from":"2016-01-01"},{"from":"1970-01-01" ,"to":"2016-01-01"}]},"aggs":{"1":{"sum":{"field":"field2"}}}}},"query":{"filtered":{"query":{"query_string":{"query":"my_query_string","analyze_wildcard":true}}}}} \n {"index":"index1","search_type":"count","ignore_unavailable":true} \n {"size":0,"timeout":0,"aggs":{"2":{"date_range":{"field":"field1","ranges":[{"from":"2016-05-01","to":"now"},{"to":"2016-05-01","from":"2016-01-01"},{"from":"1970-01-01" ,"to":"2016-01-01"}]},"aggs":{"1":{"sum":{"field":"field2"}}}}},"query":{"filtered":{"query":{"query_string":{"query":"my_other_query_string","analyze_wildcard":true}}}}} \n
It returns an array of 2 responses, with 3 buckets each and a sum in each, as expected.
I don't know if it's a regular usage since:
- "elasticsearch" is the name of my cluster, not an index
- I found the trick by putting an iframe of a Kibana dashboard on my web page (dev), and listening to network traffic when the iframe was called
- The bulk API is not supposed to perform searches...
I'm not sure if what I did was really a bulk search or something else!
I'm interested to know if there is a solution for Java bulk search though, because surprisingly my REST search is way faster than my JAVA API search, but that's another matter....