Difference about the "nested" type and "object" type?

Hi, all

I am wondering what the difference between the two types in the mappings.

I know the nested object can be query using nested query. but can the
object type field be query using other queries, such as term query?

ex, what's the difference when I change the type of "variation " to object?

{
"cloth" : {
"properties" : {
"name" : {"type" : "string", "store" : "yes", "index" : "analyzed"},
"variation" : {
"type" : "nested",
"properties" : {
"size" : {"type" : "string", "store" : "yes", "index" :
"not_analyzed"},
"color" : {"type" : "string", "store" : "yes", "index" :
"not_analyzed"}
}
}
}
}
}

In both types, I can also use "variation.size" to denote the field. So I
can use the notation "variation.size" to query this field, such as term
query:

"query" : {
"term" : {
"variation.size" : "crime"
}
}

Is that ok ?

Because the object type seems friendly to me, could you give me some
opinion about it?

Thanks a lot.

Regards,

Ivan

--
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/1be470c2-36c0-45c2-9131-907d35baf8c7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

The elasticsearch site has a short writeup about the benefits of the nested
type:

Basically, with object types, multiple instances of a field are flattened
as an unordered array. In your example, if you would not be possible to
search for an object that has a specific size and color since the query
could match on a parent object that contains an object child with the
desired size and another child with the color. Nested documents will allow
you to return only the parent documents that contain children matching all
the conditions.

Cheers,

Another Ivan

On Wed, Jan 22, 2014 at 11:41 PM, Ivan Ji hxuanji@gmail.com wrote:

Hi, all

I am wondering what the difference between the two types in the mappings.

I know the nested object can be query using nested query. but can the
object type field be query using other queries, such as term query?

ex, what's the difference when I change the type of "variation " to
object?

{
"cloth" : {
"properties" : {
"name" : {"type" : "string", "store" : "yes", "index" : "analyzed"},
"variation" : {
"type" : "nested",
"properties" : {
"size" : {"type" : "string", "store" : "yes", "index" :
"not_analyzed"},
"color" : {"type" : "string", "store" : "yes", "index" :
"not_analyzed"}
}
}
}
}
}

In both types, I can also use "variation.size" to denote the field. So I
can use the notation "variation.size" to query this field, such as term
query:

"query" : {
"term" : {
"variation.size" : "crime"
}
}

Is that ok ?

Because the object type seems friendly to me, could you give me some
opinion about it?

Thanks a lot.

Regards,

Ivan

--
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/1be470c2-36c0-45c2-9131-907d35baf8c7%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/CALY%3DcQBC9OCV%2BpL7sLV8RTe%2BLgtrgNkr0Vdn55X%3De8e%2BPKA8dw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi, Ivan

I got it!

Thanks.

Another Ivan

Ivan Brusic於 2014年1月23日星期四UTC+8下午3時52分31秒寫道:

The elasticsearch site has a short writeup about the benefits of the
nested type:
Elasticsearch Platform — Find real-time answers at scale | Elastic

Basically, with object types, multiple instances of a field are flattened
as an unordered array. In your example, if you would not be possible to
search for an object that has a specific size and color since the query
could match on a parent object that contains an object child with the
desired size and another child with the color. Nested documents will allow
you to return only the parent documents that contain children matching all
the conditions.

Cheers,

Another Ivan

On Wed, Jan 22, 2014 at 11:41 PM, Ivan Ji <hxu...@gmail.com <javascript:>>wrote:

Hi, all

I am wondering what the difference between the two types in the mappings.

I know the nested object can be query using nested query. but can the
object type field be query using other queries, such as term query?

ex, what's the difference when I change the type of "variation " to
object?

{
"cloth" : {
"properties" : {
"name" : {"type" : "string", "store" : "yes", "index" : "analyzed"},
"variation" : {
"type" : "nested",
"properties" : {
"size" : {"type" : "string", "store" : "yes", "index" :
"not_analyzed"},
"color" : {"type" : "string", "store" : "yes", "index" :
"not_analyzed"}
}
}
}
}
}

In both types, I can also use "variation.size" to denote the field. So I
can use the notation "variation.size" to query this field, such as term
query:

"query" : {
"term" : {
"variation.size" : "crime"
}
}

Is that ok ?

Because the object type seems friendly to me, could you give me some
opinion about it?

Thanks a lot.

Regards,

Ivan

--
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/1be470c2-36c0-45c2-9131-907d35baf8c7%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/f4adc713-a5f2-4d66-b918-5e0ad1bc7192%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.