Best way to store variable number of key:value fields


(Dominic Gross) #1

Hi,
I want to index some Data, where each Document should have a variable
number of fields.
An example because I can't express myself very good this morning:

Apple
Color: Green
Flavor: Sour

Mobilephone
Color: black
Os: Android

My problem is, that "Apple" should not have the field Os and the
Mobilephone shouldnt have the field Flavor in turn.

Im new to Elasticsearch, so maybe there is an easy answer for that.

--
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/783ca00e-dbae-4ad2-955a-61c1af4ef080%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Radu Gheorghe) #2

Hi Dominic,

It's not very clear to me what your question is. You want to reject Apple
documents that have an OS field?

I guess you can either have Apples and Mobilephones in their own type. This
will make it clear which fields belong to which type of document. And
because ES has dynamic mappings enabled by default, you can always add new
types of documents, or new fields to a current type:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-mapper.html#_dynamic_mappings

Best regards
Radu

Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/

On Thu, Apr 24, 2014 at 9:52 AM, Dominic Gross dvgrossd@gmail.com wrote:

Hi,
I want to index some Data, where each Document should have a variable
number of fields.
An example because I can't express myself very good this morning:

Apple
Color: Green
Flavor: Sour

Mobilephone
Color: black
Os: Android

My problem is, that "Apple" should not have the field Os and the
Mobilephone shouldnt have the field Flavor in turn.

Im new to Elasticsearch, so maybe there is an easy answer for that.

--
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/783ca00e-dbae-4ad2-955a-61c1af4ef080%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/783ca00e-dbae-4ad2-955a-61c1af4ef080%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/CAHXA0_0DSe%2BmrzZfykt42%2BFQ39EZ_Rj-UOSQ7HaKKgCg9TPcNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Dominic Gross) #3

So I can just write the two Documents (Apple and Mobilephone) to the same
Index (and the same Type?).

--
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/d4446198-a1b1-4d72-876f-711df91aa5b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Radu Gheorghe) #4

You can do that, too, yes.

On Thu, Apr 24, 2014 at 10:08 AM, Dominic Gross dvgrossd@gmail.com wrote:

So I can just write the two Documents (Apple and Mobilephone) to the same
Index (and the same Type?).

--
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/d4446198-a1b1-4d72-876f-711df91aa5b9%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/d4446198-a1b1-4d72-876f-711df91aa5b9%40googlegroups.com?utm_medium=email&utm_source=footer
.

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

--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/

--
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/CAHXA0_12sbbqWyGzu0EXCpsXOBrdXMA72KQucA4GWoxJKN%2BQxA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Dominic Gross) #5

Thats awesome, thank you for your help!

Am Donnerstag, 24. April 2014 09:10:10 UTC+2 schrieb Radu Gheorghe:

You can do that, too, yes.

On Thu, Apr 24, 2014 at 10:08 AM, Dominic Gross <dvgr...@gmail.com<javascript:>

wrote:

So I can just write the two Documents (Apple and Mobilephone) to the same
Index (and the same Type?).

--
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/d4446198-a1b1-4d72-876f-711df91aa5b9%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/d4446198-a1b1-4d72-876f-711df91aa5b9%40googlegroups.com?utm_medium=email&utm_source=footer
.

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

--
Performance Monitoring * Log Analytics * Search Analytics
Solr & Elasticsearch Support * http://sematext.com/

--
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/487a1a28-1bec-4318-8f0b-a321429cbe08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Radu Gheorghe) #6

You're welcome :slight_smile:

On Thu, Apr 24, 2014 at 10:16 AM, Dominic Gross dvgrossd@gmail.com wrote:

Thats awesome, thank you for your help!

Am Donnerstag, 24. April 2014 09:10:10 UTC+2 schrieb Radu Gheorghe:

You can do that, too, yes.

On Thu, Apr 24, 2014 at 10:08 AM, Dominic Gross dvgr...@gmail.comwrote:

So I can just write the two Documents (Apple and Mobilephone) to the
same Index (and the same Type?).

--
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/CAHXA0_1qyz4VsC8uLFwf9yAgkZs4cYYZFMxPzk7JPGm5hKEWwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #7