Multiple documents types being combined into one source

I'm indexing two different documents (building and customer) very
close to one another and I end up with two sources from different
types being combined into the source of the customer type. Any idea as
to why this is happening? I put a few line returns between the two
sources below for clarity. I am using version 0.17.4 of the Java API.

curl -XGET 'http://localhost:9200/xyz.customer.
4e52562703640801a2ba1894/customer/4e52562703640801a2ba1894?pretty=1'
{
"_index" : "xyz.customer.4e52562703640801a2ba1894",
"_type" : "customer",
"_id" : "4e52562703640801a2ba1894",
"_version" : 13,
"exists" : true, "_source" :
// THE BUILDING SOURCE
{"id":"4e5d51d2036410ce0107b7e3","customerId":"4e52562703640801a2ba1894","customerName":"Test
Organization
1","name":"test","demographics":null,"dateCreated":"2011-08-30T21:10:42.846Z","lastUpdated":"2011-08-30T21:10:42.846Z","publicTags":"","enabled":true,"address":"test
test, test test"}

// THE CUSTOMER SOURCE
{"id":"4e52562703640801a2ba1894","name":"Test Organization
1","dateCreated":"2011-08-22T13:14:15.514Z","lastUpdated":"2011-08-22T13:14:15.514Z","type":"xyztype","numberOfUsers":
3,"numberOfBuildings":13,"enabled":true}

}

How are you indexing the data? Most of the times, it comes from the fact
that XContentBuilder(s) are cached on a thread for better perf, so using two
of those in two indexing requests before executing them can result in that.
If you use it, see if using XContentFactory#safeJsonBuilder fixes it.

On Wed, Aug 31, 2011 at 12:27 AM, danpolites dpolites@gmail.com wrote:

I'm indexing two different documents (building and customer) very
close to one another and I end up with two sources from different
types being combined into the source of the customer type. Any idea as
to why this is happening? I put a few line returns between the two
sources below for clarity. I am using version 0.17.4 of the Java API.

curl -XGET 'http://localhost:9200/xyz.customer.
4e52562703640801a2ba1894/customer/4e52562703640801a2ba1894?pretty=1'
{
"_index" : "xyz.customer.4e52562703640801a2ba1894",
"_type" : "customer",
"_id" : "4e52562703640801a2ba1894",
"_version" : 13,
"exists" : true, "_source" :
// THE BUILDING SOURCE

{"id":"4e5d51d2036410ce0107b7e3","customerId":"4e52562703640801a2ba1894","customerName":"Test
Organization

1","name":"test","demographics":null,"dateCreated":"2011-08-30T21:10:42.846Z","lastUpdated":"2011-08-30T21:10:42.846Z","publicTags":"","enabled":true,"address":"test
test, test test"}

// THE CUSTOMER SOURCE
{"id":"4e52562703640801a2ba1894","name":"Test Organization

1","dateCreated":"2011-08-22T13:14:15.514Z","lastUpdated":"2011-08-22T13:14:15.514Z","type":"xyztype","numberOfUsers":
3,"numberOfBuildings":13,"enabled":true}

}

I was using the XContentFactory#jsonBuilder and switching to the
safeJsonBuilder solved my issue. Is there anything to watch out for
when using the safeJsonBuilder?

Nothing to watch when using safeJsonBuilder as it does no caching.

On Wed, Aug 31, 2011 at 1:22 AM, danpolites dpolites@gmail.com wrote:

I was using the XContentFactory#jsonBuilder and switching to the
safeJsonBuilder solved my issue. Is there anything to watch out for
when using the safeJsonBuilder?