(no subject)


(Abhishek Jajoria) #1

I have created a nested type field as
String mapping =
"{"my":{"properties":{"name":{"type":"nested"}}}}";
How can I send nested document using java
XContentBuilder b1 =
XContentFactory.jsonBuilder().startObject().field("name",);


(David Pilato) #2

Heya,

IMHO, if it's your first time with Elasticsearch, I suggest that you test functionnalities with simple documents.

So don't try to play with nested if you just want to play with percolator.

BTW, it can be useful to add subject to your messages. Otherwise, it's difficult to follow the thread.

Then, I suggest that you provide a full curl recreation.
http://www.elasticsearch.org/help/

HTH
David :wink:
@dadoonet

Le 28 févr. 2012 à 09:42, jajoria abhishek jajoria.abhishek@gmail.com a écrit :

I have created a nested type field as
String mapping = "{"my":{"properties":{"name":{"type":"nested"}}}}";
How can I send nested document using java
XContentBuilder b1 = XContentFactory.jsonBuilder().startObject().field("name",);


(Ivan Brusic) #3

Take a look at the test source code for a few examples:

https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/unit/index/mapper/nested/NestedMappingTests.java

String mapping =
XContentFactory.jsonBuilder().startObject().startObject("type").startObject("properties").startObject("nested1").field("type",
"nested").endObject().endObject().endObject().endObject().string();

The various startObjects can be confusing, but hopefully you will
eventually get used to it.

--
Ivan

On Tue, Feb 28, 2012 at 12:42 AM, jajoria abhishek
jajoria.abhishek@gmail.com wrote:

I have created a nested type field as
String mapping =
"{"my":{"properties":{"name":{"type":"nested"}}}}";
How can I send nested document using java
XContentBuilder b1 =
XContentFactory.jsonBuilder().startObject().field("name",);


(Ivan Brusic) #4

Sorry, the example I added was for the mapping. The source also has
examples for creating new documents.

On Wed, Feb 29, 2012 at 11:50 AM, Ivan Brusic ivan@brusic.com wrote:

Take a look at the test source code for a few examples:

https://github.com/elasticsearch/elasticsearch/blob/master/src/test/java/org/elasticsearch/test/unit/index/mapper/nested/NestedMappingTests.java

String mapping =
XContentFactory.jsonBuilder().startObject().startObject("type").startObject("properties").startObject("nested1").field("type",
"nested").endObject().endObject().endObject().endObject().string();

The various startObjects can be confusing, but hopefully you will
eventually get used to it.

--
Ivan

On Tue, Feb 28, 2012 at 12:42 AM, jajoria abhishek
jajoria.abhishek@gmail.com wrote:

I have created a nested type field as
String mapping =
"{"my":{"properties":{"name":{"type":"nested"}}}}";
How can I send nested document using java
XContentBuilder b1 =
XContentFactory.jsonBuilder().startObject().field("name",);


(system) #5