I'm relatively new to elasticsearch, so please bare with me. I read
through the documentation for two days and tried to write my own mapper for
some sample data. I am the CouchDB River plugin to index my CouchDB
database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have a
gist at the following link:
If you look at the python code, I specified the fields that I want returned
from the search. However, I have to use the "dot notation" to specify
which field I want returned. Look at the "product.json" file to see a
rough structure of my indexed document. Things like ID and Key are on the
very outer level of the product document so it's fine to just refer to them
using they names directly. However, I have a content JSON object which
contains keys like brand, name, description, etc. These fields have to be
referenced using the dot notation like : "content.description" or
"content.brand".
The search results contain keys with the names being set with the "dot
notation". I will pass this resultset to my frontend and have my widget
framework (I use KendoUI) parse the data. However, it fails in Firebug
saying that content is undefined because the key name is "content.brand",
and the framework thinks that content is an object with an attribute brand
but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem to
work. * My question is: "Is there a way to change the output of the key
names to say, "brand" instead of "content.brand" ? "*
*
*
Am I confusing any of you? If so, please let me know, I'll be glad to
explain my problem again.
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read
through the documentation for two days and tried to write my own mapper for
some sample data. I am the CouchDB River plugin to index my CouchDB
database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have a
gist at the following link:
If you look at the python code, I specified the fields that I want
returned from the search. However, I have to use the "dot notation" to
specify which field I want returned. Look at the "product.json" file to
see a rough structure of my indexed document. Things like ID and Key are
on the very outer level of the product document so it's fine to just refer
to them using they names directly. However, I have a content JSON object
which contains keys like brand, name, description, etc. These fields have
to be referenced using the dot notation like : "content.description" or
"content.brand".
The search results contain keys with the names being set with the "dot
notation". I will pass this resultset to my frontend and have my widget
framework (I use KendoUI) parse the data. However, it fails in Firebug
saying that content is undefined because the key name is "content.brand",
and the framework thinks that content is an object with an attribute brand
but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem
to work. * My question is: "Is there a way to change the output of the
key names to say, "brand" instead of "content.brand" ? "*
*
*
Am I confusing any of you? If so, please let me know, I'll be glad to
explain my problem again.
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read through the documentation for two days and tried to write my own mapper for some sample data. I am the CouchDB River plugin to index my CouchDB database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have a gist at the following link:
If you look at the python code, I specified the fields that I want returned from the search. However, I have to use the "dot notation" to specify which field I want returned. Look at the "product.json" file to see a rough structure of my indexed document. Things like ID and Key are on the very outer level of the product document so it's fine to just refer to them using they names directly. However, I have a content JSON object which contains keys like brand, name, description, etc. These fields have to be referenced using the dot notation like : "content.description" or "content.brand".
The search results contain keys with the names being set with the "dot notation". I will pass this resultset to my frontend and have my widget framework (I use KendoUI) parse the data. However, it fails in Firebug saying that content is undefined because the key name is "content.brand", and the framework thinks that content is an object with an attribute brand but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem to work. My question is: "Is there a way to change the output of the key names to say, "brand" instead of "content.brand" ? "
Am I confusing any of you? If so, please let me know, I'll be glad to explain my problem again.
Sorry, I don't see how this helps. I did mention I am already using the
Elasticsearch river couchdb plugin. I don't think it has anything to do
with this plugin.
On Sun, Aug 12, 2012 at 11:04 PM, David Pilato david@pilato.fr wrote:
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read
through the documentation for two days and tried to write my own mapper for
some sample data. I am the CouchDB River plugin to index my CouchDB
database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have
a gist at the following link:
If you look at the python code, I specified the fields that I want
returned from the search. However, I have to use the "dot notation" to
specify which field I want returned. Look at the "product.json" file to
see a rough structure of my indexed document. Things like ID and Key are
on the very outer level of the product document so it's fine to just refer
to them using they names directly. However, I have a content JSON object
which contains keys like brand, name, description, etc. These fields have
to be referenced using the dot notation like : "content.description" or
"content.brand".
The search results contain keys with the names being set with the "dot
notation". I will pass this resultset to my frontend and have my widget
framework (I use KendoUI) parse the data. However, it fails in Firebug
saying that content is undefined because the key name is "content.brand",
and the framework thinks that content is an object with an attribute brand
but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem
to work. * My question is: "Is there a way to change the output of the
key names to say, "brand" instead of "content.brand" ? "*
*
*
Am I confusing any of you? If so, please let me know, I'll be glad to
explain my problem again.
Sorry, I don't see how this helps. I did mention I am already using the Elasticsearch river couchdb plugin. I don't think it has anything to do with this plugin.
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read through the documentation for two days and tried to write my own mapper for some sample data. I am the CouchDB River plugin to index my CouchDB database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have a gist at the following link:
If you look at the python code, I specified the fields that I want returned from the search. However, I have to use the "dot notation" to specify which field I want returned. Look at the "product.json" file to see a rough structure of my indexed document. Things like ID and Key are on the very outer level of the product document so it's fine to just refer to them using they names directly. However, I have a content JSON object which contains keys like brand, name, description, etc. These fields have to be referenced using the dot notation like : "content.description" or "content.brand".
The search results contain keys with the names being set with the "dot notation". I will pass this resultset to my frontend and have my widget framework (I use KendoUI) parse the data. However, it fails in Firebug saying that content is undefined because the key name is "content.brand", and the framework thinks that content is an object with an attribute brand but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem to work. My question is: "Is there a way to change the output of the key names to say, "brand" instead of "content.brand" ? "
Am I confusing any of you? If so, please let me know, I'll be glad to explain my problem again.
Ok...so you mean, if I want something within content to have an output
field name without the dot-notation, I have to remap it to the first level
using script?
That seems rather tedious...I'll give it a try thanks. There has to be a
much better way of doing this right?!
On Monday, 13 August 2012 00:15:46 UTC+8, David Pilato wrote:
Le 12 août 2012 à 17:16, Zhenghao Huang <zheng...@gmail.com <javascript:>>
a écrit :
Sorry, I don't see how this helps. I did mention I am already using the
Elasticsearch river couchdb plugin. I don't think it has anything to do
with this plugin.
On Sun, Aug 12, 2012 at 11:04 PM, David Pilato <da...@pilato.fr<javascript:>
Le 12 août 2012 à 16:51, Mark Huang <zheng...@gmail.com <javascript:>> a
écrit :
Please, anyone can help?
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read
through the documentation for two days and tried to write my own mapper for
some sample data. I am the CouchDB River plugin to index my CouchDB
database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have
a gist at the following link:
If you look at the python code, I specified the fields that I want
returned from the search. However, I have to use the "dot notation" to
specify which field I want returned. Look at the "product.json" file to
see a rough structure of my indexed document. Things like ID and Key are
on the very outer level of the product document so it's fine to just refer
to them using they names directly. However, I have a content JSON object
which contains keys like brand, name, description, etc. These fields have
to be referenced using the dot notation like : "content.description" or
"content.brand".
The search results contain keys with the names being set with the "dot
notation". I will pass this resultset to my frontend and have my widget
framework (I use KendoUI) parse the data. However, it fails in Firebug
saying that content is undefined because the key name is "content.brand",
and the framework thinks that content is an object with an attribute brand
but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem
to work. * My question is: "Is there a way to change the output of the
key names to say, "brand" instead of "content.brand" ? "*
*
*
Am I confusing any of you? If so, please let me know, I'll be glad to
explain my problem again.
Ok...so you mean, if I want something within content to have an output field name without the dot-notation, I have to remap it to the first level using script?
That seems rather tedious...I'll give it a try thanks. There has to be a much better way of doing this right?!
On Monday, 13 August 2012 00:15:46 UTC+8, David Pilato wrote:
Try something like:
{ "type" : "couchdb", "couchdb" : { "script" : "ctx.doc.brand = ctx.doc.content.brand;ctx.doc.content.brand=null;"
}
}
Does it help?
Sorry, I don't see how this helps. I did mention I am already using the Elasticsearch river couchdb plugin. I don't think it has anything to do with this plugin.
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read through the documentation for two days and tried to write my own mapper for some sample data. I am the CouchDB River plugin to index my CouchDB database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I have a gist at the following link:
If you look at the python code, I specified the fields that I want returned from the search. However, I have to use the "dot notation" to specify which field I want returned. Look at the "product.json" file to see a rough structure of my indexed document. Things like ID and Key are on the very outer level of the product document so it's fine to just refer to them using they names directly. However, I have a content JSON object which contains keys like brand, name, description, etc. These fields have to be referenced using the dot notation like : "content.description" or "content.brand".
The search results contain keys with the names being set with the "dot notation". I will pass this resultset to my frontend and have my widget framework (I use KendoUI) parse the data. However, it fails in Firebug saying that content is undefined because the key name is "content.brand", and the framework thinks that content is an object with an attribute brand but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't seem to work. My question is: "Is there a way to change the output of the key names to say, "brand" instead of "content.brand" ? "
Am I confusing any of you? If so, please let me know, I'll be glad to explain my problem again.
Tested this today and it did solved my problem. But it created another
problem for me which I have just started a new threadhttps://groups.google.com/forum/?fromgroups#!topic/elasticsearch/S0bmeMvnLyQ[1-25]on. The problem I am facing is that, I want different fields for different
types. That would mean I have to index my database based on type. Am I
correct? I've been reading the docs here and there and I still can't
figure out a solution.
On Sunday, 12 August 2012 14:29:45 UTC-5, David Pilato wrote:
Yes. My opinion is that you should index documents as you want to retrieve
it after. So I will do it that way.
My 2 cents.
David
--
Le 12 août 2012 à 18:42, Mark Huang <zheng...@gmail.com <javascript:>> a
écrit :
Ok...so you mean, if I want something within content to have an output
field name without the dot-notation, I have to remap it to the first level
using script?
That seems rather tedious...I'll give it a try thanks. There has to be a
much better way of doing this right?!
On Monday, 13 August 2012 00:15:46 UTC+8, David Pilato wrote:
Sorry, I don't see how this helps. I did mention I am already using the
Elasticsearch river couchdb plugin. I don't think it has anything to do
with this plugin.
On Sun, Aug 12, 2012 at 11:04 PM, David Pilato da...@pilato.fr wrote:
On Sunday, August 12, 2012 1:56:24 AM UTC+8, Mark Huang wrote:
Hi,
I'm relatively new to elasticsearch, so please bare with me. I read
through the documentation for two days and tried to write my own mapper for
some sample data. I am the CouchDB River plugin to index my CouchDB
database. I also use Python's pyes library to query against elasticsearch.
I'm encountering a problem with my search results at the moment. I
have a gist at the following link:
If you look at the python code, I specified the fields that I want
returned from the search. However, I have to use the "dot notation" to
specify which field I want returned. Look at the "product.json" file to
see a rough structure of my indexed document. Things like ID and Key are
on the very outer level of the product document so it's fine to just refer
to them using they names directly. However, I have a content JSON object
which contains keys like brand, name, description, etc. These fields have
to be referenced using the dot notation like : "content.description" or
"content.brand".
The search results contain keys with the names being set with the "dot
notation". I will pass this resultset to my frontend and have my widget
framework (I use KendoUI) parse the data. However, it fails in Firebug
saying that content is undefined because the key name is "content.brand",
and the framework thinks that content is an object with an attribute brand
but the search results actually have a key named "content.brand"!
I tried using the index_name attribute during mapping but it didn't
seem to work. * My question is: "Is there a way to change the output
of the key names to say, "brand" instead of "content.brand" ? "*
*
*
Am I confusing any of you? If so, please let me know, I'll be glad to
explain my problem again.
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.