I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored without
the user information. In the log files, the user entry is sent as string
('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user object,
but I don't know if that is the Java way or even a nice way to doit.
I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored without
the user information. In the log files, the user entry is sent as string
('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user object,
but I don't know if that is the Java way or even a nice way to doit.
Thanks for the response, but sadly I didn't got it working.
I don't understand where should I put the extra startObject and endObjects
calls. The user object is already created with startObject and endObject.
If I call them when adding the user object to the content one I got an
exception.
Could you please be a little more specific, and perhaps with the two or
three lines that will do what you said ? ... I'm really new with Java and
I'm still struggling with language issues :S
Thanks.
Martin
On Tue, Dec 6, 2011 at 17:37, Shay Banon kimchy@gmail.com wrote:
When you build the json, you need to have another "startObject" and
"endObject" to wrap the json you construct (startObject == {, endObject ==
}).
I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored without
the user information. In the log files, the user entry is sent as string
('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user object,
but I don't know if that is the Java way or even a nice way to doit.
Sorry, I got confused by your code a bit. I commented with something that
should work (the user aspect). I also added setId just so you can more
easily fetch it by id (if you test it), nad actionGet() at the end of the
index to wait for the index operation to finish (execute is async).
Thanks for the response, but sadly I didn't got it working.
I don't understand where should I put the extra startObject and endObjects
calls. The user object is already created with startObject and endObject.
If I call them when adding the user object to the content one I got an
exception.
Could you please be a little more specific, and perhaps with the two or
three lines that will do what you said ? ... I'm really new with Java and
I'm still struggling with language issues :S
Thanks.
Martin
On Tue, Dec 6, 2011 at 17:37, Shay Banon kimchy@gmail.com wrote:
When you build the json, you need to have another "startObject" and
"endObject" to wrap the json you construct (startObject == {, endObject ==
}).
I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored
without the user information. In the log files, the user entry is sent as
string ('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user
object, but I don't know if that is the Java way or even a nice way to doit.
Thanks, I'm looking it right know and will try it in a bit ...
Martin
On Wed, Dec 7, 2011 at 12:54, Shay Banon kimchy@gmail.com wrote:
Sorry, I got confused by your code a bit. I commented with something that
should work (the user aspect). I also added setId just so you can more
easily fetch it by id (if you test it), nad actionGet() at the end of the
index to wait for the index operation to finish (execute is async).
Thanks for the response, but sadly I didn't got it working.
I don't understand where should I put the extra startObject and
endObjects calls. The user object is already created with startObject and
endObject. If I call them when adding the user object to the content one I
got an exception.
Could you please be a little more specific, and perhaps with the two or
three lines that will do what you said ? ... I'm really new with Java and
I'm still struggling with language issues :S
Thanks.
Martin
On Tue, Dec 6, 2011 at 17:37, Shay Banon kimchy@gmail.com wrote:
When you build the json, you need to have another "startObject" and
"endObject" to wrap the json you construct (startObject == {, endObject ==
}).
I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored
without the user information. In the log files, the user entry is sent as
string ('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user
object, but I don't know if that is the Java way or even a nice way to doit.
Hope you bit the bullet sometime for Java but you can probably avoid using
it - at least to start/evaluate. I believe the ElastiSearc Head plugin only
uses JavaScript to interact with ES. You might be able to do JS call
replacements under Django.This might not be your long term solution but
could let you see what ES can do. I also believe there are some JS clients
for ES out there - though not sure if any are current/blessed.
--Mike
Thanks for the response, but sadly I didn't got it working.
I don't understand where should I put the extra startObject and endObjects
calls. The user object is already created with startObject and endObject.
If I call them when adding the user object to the content one I got an
exception.
Could you please be a little more specific, and perhaps with the two or
three lines that will do what you said ? ... I'm really new with Java and
I'm still struggling with language issues :S
Thanks.
Martin
On Tue, Dec 6, 2011 at 17:37, Shay Banon kimchy@gmail.com wrote:
When you build the json, you need to have another "startObject" and
"endObject" to wrap the json you construct (startObject == {, endObject ==
}).
I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored
without the user information. In the log files, the user entry is sent as
string ('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user
object, but I don't know if that is the Java way or even a nice way to doit.
Hope you bit the bullet sometime for Java but you can probably avoid using
it - at least to start/evaluate. I believe the ElastiSearc Head plugin only
uses JavaScript to interact with ES. You might be able to do JS call
replacements under Django.This might not be your long term solution but
could let you see what ES can do. I also believe there are some JS clients
for ES out there - though not sure if any are current/blessed.
--Mike
Thanks for the response, but sadly I didn't got it working.
I don't understand where should I put the extra startObject and
endObjects calls. The user object is already created with startObject and
endObject. If I call them when adding the user object to the content one I
got an exception.
Could you please be a little more specific, and perhaps with the two or
three lines that will do what you said ? ... I'm really new with Java and
I'm still struggling with language issues :S
Thanks.
Martin
On Tue, Dec 6, 2011 at 17:37, Shay Banon kimchy@gmail.com wrote:
When you build the json, you need to have another "startObject" and
"endObject" to wrap the json you construct (startObject == {, endObject ==
}).
I'm testing Elasticsearch as replacement to our current MongoDB
implementation for storing and searching information.
The application I'm working on has a Django frontend that query the
information, and an engine built with Java. I have almost no experience
working with Java, so I'm having some trouble to figure out how to store
objects that have other objects as attributes.
As you can see in here (1), I'm creating an user object with the
information I need to store, and then I set this user as a content
attribute.
I know I'm doing something wrong because the document gets stored
without the user information. In the log files, the user entry is sent as
string ('user': {'type': 'string'}) .
I thought to use a Map to store those fields I need from the user
object, but I don't know if that is the Java way or even a nice way to doit.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.