Simple Array Example


(EzCocos) #1

Dear All,
I am trying to upload via a river to Elasticsearch some MySQL data which
look like this:
product_id product_info_id
'1' 1
'1' 2
'2' 3
'2' 4

I am looking to have in Elasticsearch for this example 2 documents with _id
'1' and '2' containing each an array of product_info_id.

I have been struggling with this for days, I get either 4 documents or 2
documents stored and 2 deleted. The mapping I used so far is this:
{
"product_merchant" : {
"_source" : { "enabled" : false },
"_id" : { "path" : "product_id" },
"properties" : {
"product_infos" : {
"properties" : {
"product_info_id" : { "type" : "integer", "store" : "yes" }
}
}
}
}
}

Could anyone help me to correct my mapping and/or provide some array
examples?

Many thanks in advance,
jm

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #2

Hello ,

Is product_id unique , seems to me its not.
In that case why have you made it as _id.
_id should be unique and in face of dedupe , it would be over written.
So remove defenition of _id should solve the issue.

Thanks
Vineeth

On Tue, Sep 9, 2014 at 4:09 PM, EzCocos jmdepinay@gmail.com wrote:

Dear All,
I am trying to upload via a river to Elasticsearch some MySQL data which
look like this:
product_id product_info_id
'1' 1
'1' 2
'2' 3
'2' 4

I am looking to have in Elasticsearch for this example 2 documents with
_id '1' and '2' containing each an array of product_info_id.

I have been struggling with this for days, I get either 4 documents or 2
documents stored and 2 deleted. The mapping I used so far is this:
{
"product_merchant" : {
"_source" : { "enabled" : false },
"_id" : { "path" : "product_id" },
"properties" : {
"product_infos" : {
"properties" : {
"product_info_id" : { "type" : "integer", "store" : "yes" }
}
}
}
}
}

Could anyone help me to correct my mapping and/or provide some array
examples?

Many thanks in advance,
jm

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nyKqodCq9HG4V3k47m6kiAYfQuNSsvteYKLF2n1CLhRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(EzCocos) #3

Many thanks Vineeth for your help.

product_id is indeed unique. If I remove _id I get 4 documents rather than
2 documents containing each an array of related product_info_id.

I guess I want _id to be the key under which same product_id got
aggregated. In other word if I remove _id, how Elasticsearch will know
under which Key aggregate the array items (product_info_id).

I suppose this is a basic issue but I just can't make it work...

Many thanks in advance for your help.
Ez

On Tuesday, 9 September 2014 13:01:46 UTC+1, vineeth mohan wrote:

Hello ,

Is product_id unique , seems to me its not.
In that case why have you made it as _id.
_id should be unique and in face of dedupe , it would be over written.
So remove defenition of _id should solve the issue.

Thanks
Vineeth

On Tue, Sep 9, 2014 at 4:09 PM, EzCocos <jmde...@gmail.com <javascript:>>
wrote:

Dear All,
I am trying to upload via a river to Elasticsearch some MySQL data which
look like this:
product_id product_info_id
'1' 1
'1' 2
'2' 3
'2' 4

I am looking to have in Elasticsearch for this example 2 documents with
_id '1' and '2' containing each an array of product_info_id.

I have been struggling with this for days, I get either 4 documents or 2
documents stored and 2 deleted. The mapping I used so far is this:
{
"product_merchant" : {
"_source" : { "enabled" : false },
"_id" : { "path" : "product_id" },
"properties" : {
"product_infos" : {
"properties" : {
"product_info_id" : { "type" : "integer", "store" : "yes" }
}
}
}
}
}

Could anyone help me to correct my mapping and/or provide some array
examples?

Many thanks in advance,
jm

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ddef0646-cd57-4027-9086-43f83ab40a0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #4

Hello ,

In that case you should make product_id as _type rather than _id.

Thanks
Vineeth

On Tue, Sep 9, 2014 at 6:38 PM, EzCocos jmdepinay@gmail.com wrote:

Many thanks Vineeth for your help.

product_id is indeed unique. If I remove _id I get 4 documents rather than
2 documents containing each an array of related product_info_id.

I guess I want _id to be the key under which same product_id got
aggregated. In other word if I remove _id, how Elasticsearch will know
under which Key aggregate the array items (product_info_id).

I suppose this is a basic issue but I just can't make it work...

Many thanks in advance for your help.
Ez

On Tuesday, 9 September 2014 13:01:46 UTC+1, vineeth mohan wrote:

Hello ,

Is product_id unique , seems to me its not.
In that case why have you made it as _id.
_id should be unique and in face of dedupe , it would be over written.
So remove defenition of _id should solve the issue.

Thanks
Vineeth

On Tue, Sep 9, 2014 at 4:09 PM, EzCocos jmde...@gmail.com wrote:

Dear All,
I am trying to upload via a river to Elasticsearch some MySQL data which
look like this:
product_id product_info_id
'1' 1
'1' 2
'2' 3
'2' 4

I am looking to have in Elasticsearch for this example 2 documents with
_id '1' and '2' containing each an array of product_info_id.

I have been struggling with this for days, I get either 4 documents or 2
documents stored and 2 deleted. The mapping I used so far is this:
{
"product_merchant" : {
"_source" : { "enabled" : false },
"_id" : { "path" : "product_id" },
"properties" : {
"product_infos" : {
"properties" : {
"product_info_id" : { "type" : "integer", "store" : "yes" }
}
}
}
}
}

Could anyone help me to correct my mapping and/or provide some array
examples?

Many thanks in advance,
jm

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ddef0646-cd57-4027-9086-43f83ab40a0f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/ddef0646-cd57-4027-9086-43f83ab40a0f%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5neQNWKgbV%3DGFndEOwc5CoWs6CWf_kUJA2zZx580p3iGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(EzCocos) #5

Sorry! but I don't understand. I tried to replace _id by _type and I get 4
documents.

Would you be able to give me the related short mapping that would work? For
instance for the data:

product_id product_info_id
'1' 1
'1' 2
'2' 3
'2' 4

I would like to create via a river (select * from product_table) and get 2
Elasticsearch documents. The one with id=1 containing an array of
product_info_id containing (1,2) and the one with id=2 the
product_info_id=(3,4).

Many thanks in advance.
Ez

On Tuesday, 9 September 2014 14:44:32 UTC+1, vineeth mohan wrote:

Hello ,

In that case you should make product_id as _type rather than _id.

Thanks
Vineeth

On Tue, Sep 9, 2014 at 6:38 PM, EzCocos <jmde...@gmail.com <javascript:>>
wrote:

Many thanks Vineeth for your help.

product_id is indeed unique. If I remove _id I get 4 documents rather
than 2 documents containing each an array of related product_info_id.

I guess I want _id to be the key under which same product_id got
aggregated. In other word if I remove _id, how Elasticsearch will know
under which Key aggregate the array items (product_info_id).

I suppose this is a basic issue but I just can't make it work...

Many thanks in advance for your help.
Ez

On Tuesday, 9 September 2014 13:01:46 UTC+1, vineeth mohan wrote:

Hello ,

Is product_id unique , seems to me its not.
In that case why have you made it as _id.
_id should be unique and in face of dedupe , it would be over written.
So remove defenition of _id should solve the issue.

Thanks
Vineeth

On Tue, Sep 9, 2014 at 4:09 PM, EzCocos jmde...@gmail.com wrote:

Dear All,
I am trying to upload via a river to Elasticsearch some MySQL data
which look like this:
product_id product_info_id
'1' 1
'1' 2
'2' 3
'2' 4

I am looking to have in Elasticsearch for this example 2 documents with
_id '1' and '2' containing each an array of product_info_id.

I have been struggling with this for days, I get either 4 documents or
2 documents stored and 2 deleted. The mapping I used so far is this:
{
"product_merchant" : {
"_source" : { "enabled" : false },
"_id" : { "path" : "product_id" },
"properties" : {
"product_infos" : {
"properties" : {
"product_info_id" : { "type" : "integer", "store" : "yes" }
}
}
}
}
}

Could anyone help me to correct my mapping and/or provide some array
examples?

Many thanks in advance,
jm

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/05aa08d0-8a3e-440e-8131-cb37c70d10df%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ddef0646-cd57-4027-9086-43f83ab40a0f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/ddef0646-cd57-4027-9086-43f83ab40a0f%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/669a41da-8719-477e-96c4-27e1492601a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #6