Bulk API

Hello!
I'm trying to use Bulk API to search but got error [_bulk] Invalid index
name [bulk], must not start with ''

Example:

$ curl -XPOST 'http://localhost:9200/_bulk' -d '
{ "search" : { "_index" : "test_contacts", "_type" : "contact"} }
{"query": {"query_string": {"query":
"fields.first_name:\u042f\u0440\u0438\u043a"}}}
{ "search" : { "_index" : "test_contacts", "_type" : "contact"} }
{"query": {"query_string": {"query": "fields.first_name:Gorovoy"}}}
'
{"error":"[_bulk] Invalid index name [bulk], must not start with ''"}

Were I'm wrong?

--
Andrew Degtiariov
DA-RIPE

Hi Andrew

I'm trying to use Bulk API to search but got error [_bulk] Invalid
index name [bulk], must not start with ''

Example:

$ curl -XPOST 'http://localhost:9200/_bulk' -d '
{ "search" : { "_index" : "test_contacts", "_type" : "contact"} }
{"query": {"query_string": {"query": "fields.first_name:\u042f\u0440
\u0438\u043a"}}}

The bulk interface is for index|create|delete statements, not for
searches (at least not yet - who knows what the future holds)

clint

On Sun, Nov 14, 2010 at 4:17 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

Hi Andrew

I'm trying to use Bulk API to search but got error [_bulk] Invalid
index name [bulk], must not start with ''

Example:

$ curl -XPOST 'http://localhost:9200/_bulk' -d '
{ "search" : { "_index" : "test_contacts", "_type" : "contact"} }
{"query": {"query_string": {"query": "fields.first_name:\u042f\u0440
\u0438\u043a"}}}

The bulk interface is for index|create|delete statements, not for
searches (at least not yet - who knows what the future holds)

clint

I see, thank you for the fast reply

--
Andrew Degtiariov
DA-RIPE

I had the similar problem so did you find the solution? :slight_smile:

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. :cry:

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:

  1. "elasticsearch" is the name of my cluster, not an index
  2. 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
  3. 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....

I think you want the prepareMultiSearch method in the transport client?

Yes, you're right! I think I found the solution with the REST bulk-like call, and then try to stick to it without thinking enough.... Thank you very much!

And now I realise that my "bulk-like" call is simply the multi_search API.
I think I just need to reread the docs and stop spaming the forum...

Thanks again!