Source document is not storing as mentioned in java api

Hi,

When i set the following source using java api while creating the
document, it is being stored in a wrong way.
{
"extID": "ConstructionProject",
"catName": [
{
"language": "en",
"text": "ProjectWBSType",
"original": false
}
],
"typeIcon": "",
"changedOn": "2012-01-27T18:47:14+0530",
"busUntis": "4e52b623a9801a7a3ba86c8e Test Company",
"tags": "",
"comments": "",
"responsible": "Prashanth"
}

When i do the query on the above document, in the search result,
following source is being displayed.

Used REST URL :http://localhost:9200/100-en/TypeName/
4e6601afa980073d473d491b

{
"_index": "100-en",
"_type": "TypeName",
"_id": "4e6601afa980073d473d491b",
"_version": 2,
"exists": true,
"_source": {
"changedOn": "2012-01-27T18:47:14+0530",
"responsible": "prashanth"
}
}

Please let me know what is being done in a wrong way.

Thanks,
Prashanth

When I create the document using PUT request with the above JSON data,
everything is working as expected( REST GET API is returning the same
data that i have used to insert )..Seems issue with java api.i used
the following piece of code..
IndexRequestBuilder indexBuilder = esClient.prepareIndex(
"indexname"," type", documentId);

	indexBuilder.setSource("above JSON String").execute();

Try this :

String jsonByteArray = "above JSON String".getBytes("UTF-8");
indexBuilder.setSource(jsonByteArray).execute();

Hope it will work

2012/2/3 Prashanth prashanth.byrapu@gmail.com

When I create the document using PUT request with the above JSON data,
everything is working as expected( REST GET API is returning the same
data that i have used to insert )..Seems issue with java api.i used
the following piece of code..
IndexRequestBuilder indexBuilder = esClient.prepareIndex(
"indexname"," type", documentId);

           indexBuilder.setSource("above JSON String").execute();

--
Cordialement/Regards,

Louis GUEYE
linkedin http://fr.linkedin.com/in/louisgueye |
bloghttp://deepintojee.wordpress.com/|
twitter http://twitter.com/#!/lgueye

I have tired this..no luck :frowning:

On Feb 3, 9:56 pm, louis gueye louis.gu...@gmail.com wrote:

Try this :

String jsonByteArray = "above JSON String".getBytes("UTF-8");
indexBuilder.setSource(jsonByteArray).execute();

Hope it will work

2012/2/3 Prashanth prashanth.byr...@gmail.com

When I create the document using PUT request with the above JSON data,
everything is working as expected( REST GET API is returning the same
data that i have used to insert )..Seems issue with java api.i used
the following piece of code..
IndexRequestBuilder indexBuilder = esClient.prepareIndex(
"indexname"," type", documentId);

           indexBuilder.setSource("above JSON String").execute();

--
Cordialement/Regards,

Louis GUEYE
linkedin http://fr.linkedin.com/in/louisgueye |
bloghttp://deepintojee.wordpress.com/|
twitter http://twitter.com/#!/lgueye

Can you gist your code that index the document?

On Saturday, February 4, 2012 at 2:27 AM, Prashanth wrote:

I have tired this..no luck :frowning:

On Feb 3, 9:56 pm, louis gueye <louis.gu...@gmail.com (http://gmail.com)> wrote:

Try this :

String jsonByteArray = "above JSON String".getBytes("UTF-8");
indexBuilder.setSource(jsonByteArray).execute();

Hope it will work

2012/2/3 Prashanth <prashanth.byr...@gmail.com (http://gmail.com)>

When I create the document using PUT request with the above JSON data,
everything is working as expected( REST GET API is returning the same
data that i have used to insert )..Seems issue with java api.i used
the following piece of code..
IndexRequestBuilder indexBuilder = esClient.prepareIndex(
"indexname"," type", documentId);

           indexBuilder.setSource("above JSON String").execute();

--
Cordialement/Regards,

Louis GUEYE
linkedin http://fr.linkedin.com/in/louisgueye |
bloghttp://deepintojee.wordpress.com/|
twitter http://twitter.com/#!/lgueye

Hi Shay,

  Is there any logging or any other trouble shooting mechanism to

find out the exact issue here?.

  If I pass the same data in stand alone program , everything is

working fine. But, in the integrated environment , issue is coming. I
have double checked everything from my side and looks like the same
string value is passed to setSource method using java api. I can see
the exact string value in the log file also but after creating the
index, the data is not same as it is shown in the logger.

Below is the code snippet --
Client esClient = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

	IndexRequestBuilder indexBuilder = esClient.prepareIndex("index3",

"objecttype", "123456");
// Get Json Data..using gson library..by converting a java bean to
json.
logger.info("Json String :: " + jsonData );
indexBuilder.setSource(jsonData);

Thanks,
Prashanth

On Feb 5, 10:27 am, Shay Banon kim...@gmail.com wrote:

Can you gist your code that index the document?

On Saturday, February 4, 2012 at 2:27 AM, Prashanth wrote:

I have tired this..no luck :frowning:

On Feb 3, 9:56 pm, louis gueye <louis.gu...@gmail.com (http://gmail.com)> wrote:

Try this :

String jsonByteArray = "above JSON String".getBytes("UTF-8");
indexBuilder.setSource(jsonByteArray).execute();

Hope it will work

2012/2/3 Prashanth <prashanth.byr...@gmail.com (http://gmail.com)>

When I create the document using PUT request with the above JSON data,
everything is working as expected( REST GET API is returning the same
data that i have used to insert )..Seems issue with java api.i used
the following piece of code..
IndexRequestBuilder indexBuilder = esClient.prepareIndex(
"indexname"," type", documentId);

           indexBuilder.setSource("above JSON String").execute();

--
Cordialement/Regards,

Louis GUEYE
linkedin http://fr.linkedin.com/in/louisgueye |
bloghttp://deepintojee.wordpress.com/|
twitter http://twitter.com/#!/lgueye

sorry, issue is found finally and it is in my coding... :-).. thanks
for your help

On Feb 27, 1:33 am, Prashanth prashanth.byr...@gmail.com wrote:

Hi Shay,

  Is there any logging or any other trouble shooting mechanism to

find out the exact issue here?.

  If I pass the same data in stand alone program , everything is

working fine. But, in the integrated environment , issue is coming. I
have double checked everything from my side and looks like the same
string value is passed to setSource method using java api. I can see
the exact string value in the log file also but after creating the
index, the data is not same as it is shown in the logger.

Below is the code snippet --
Client esClient = new TransportClient()
.addTransportAddress(new InetSocketTransportAddress(
"localhost", 9300));

            IndexRequestBuilder indexBuilder = esClient.prepareIndex("index3",

"objecttype", "123456");
// Get Json Data..using gson library..by converting a java bean to
json.
logger.info("Json String :: " + jsonData );
indexBuilder.setSource(jsonData);

Thanks,
Prashanth

On Feb 5, 10:27 am, Shay Banon kim...@gmail.com wrote:

Can you gist your code that index the document?

On Saturday, February 4, 2012 at 2:27 AM, Prashanth wrote:

I have tired this..no luck :frowning:

On Feb 3, 9:56 pm, louis gueye <louis.gu...@gmail.com (http://gmail.com)> wrote:

Try this :

String jsonByteArray = "above JSON String".getBytes("UTF-8");
indexBuilder.setSource(jsonByteArray).execute();

Hope it will work

2012/2/3 Prashanth <prashanth.byr...@gmail.com (http://gmail.com)>

When I create the document using PUT request with the above JSON data,
everything is working as expected( REST GET API is returning the same
data that i have used to insert )..Seems issue with java api.i used
the following piece of code..
IndexRequestBuilder indexBuilder = esClient.prepareIndex(
"indexname"," type", documentId);

           indexBuilder.setSource("above JSON String").execute();

--
Cordialement/Regards,

Louis GUEYE
linkedin http://fr.linkedin.com/in/louisgueye |
bloghttp://deepintojee.wordpress.com/|
twitter http://twitter.com/#!/lgueye