Corrent mapping for a nesed multi_field property?

I'm trying to return a single value if I search on a field that contains a
list. Tags is my list and I have three values in it one, two and three.

tags : ["one", "two", "three"]

If I do a search for "two" I would like to only return the "two" in the
value in the results.

I understand that a nested type is the way to go. The field "tag" is a
multi field property as I'm analysing it in multiple ways. I having trouble
getting a nested type working with a with a multi-field property. Here is
the mapping of the tags at the moment:

{
"document": {
"properties": {
"tags":{
"type": "multi_field",
"fields":{
"tags" {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hello,

If you only need the "two" returned (and only that), I guess you'll need
parent-child relationships. Here are some references:

If you only need to highlight, the "two" there, you'd probably need
highlighting:

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Sat, Jun 15, 2013 at 8:54 PM, es newbie dan.tuffery@gmail.com wrote:

I'm trying to return a single value if I search on a field that contains a
list. Tags is my list and I have three values in it one, two and three.

tags : ["one", "two", "three"]

If I do a search for "two" I would like to only return the "two" in the
value in the results.

I understand that a nested type is the way to go. The field "tag" is a
multi field property as I'm analysing it in multiple ways. I having trouble
getting a nested type working with a with a multi-field property. Here is
the mapping of the tags at the moment:

{
"document": {
"properties": {
"tags":{
"type": "multi_field",
"fields":{
"tags" {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks I'll take a look at that.

On Sunday, June 16, 2013 12:59:07 PM UTC+1, Radu Gheorghe wrote:

Hello,

If you only need the "two" returned (and only that), I guess you'll need
parent-child relationships. Here are some references:
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

If you only need to highlight, the "two" there, you'd probably need
highlighting:
Elasticsearch Platform — Find real-time answers at scale | Elastic

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Sat, Jun 15, 2013 at 8:54 PM, es newbie <dan.t...@gmail.com<javascript:>

wrote:

I'm trying to return a single value if I search on a field that contains
a list. Tags is my list and I have three values in it one, two and three.

tags : ["one", "two", "three"]

If I do a search for "two" I would like to only return the "two" in the
value in the results.

I understand that a nested type is the way to go. The field "tag" is a
multi field property as I'm analysing it in multiple ways. I having trouble
getting a nested type working with a with a multi-field property. Here is
the mapping of the tags at the moment:

{
"document": {
"properties": {
"tags":{
"type": "multi_field",
"fields":{
"tags" {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}

--
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:>.
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Radu,

I'm not sure the the child/parent mapping is the way to go.

The tags field is indexed in multiple ways, so I need to to be a
multi_valued field. I want to return all values in the tag array for some
queries. For an autocomplete search I only want to return the value in the
array that is a match, not all of the values in the array. I also don't
want to have to index the document fields twice, once for the document and
once for the tags. Can I not do what I want with a nested type?

On Sunday, June 16, 2013 1:33:27 PM UTC+1, es newbie wrote:

Thanks I'll take a look at that.

On Sunday, June 16, 2013 12:59:07 PM UTC+1, Radu Gheorghe wrote:

Hello,

If you only need the "two" returned (and only that), I guess you'll need
parent-child relationships. Here are some references:
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic
Elasticsearch Platform — Find real-time answers at scale | Elastic

If you only need to highlight, the "two" there, you'd probably need
highlighting:
Elasticsearch Platform — Find real-time answers at scale | Elastic

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Sat, Jun 15, 2013 at 8:54 PM, es newbie dan.t...@gmail.com wrote:

I'm trying to return a single value if I search on a field that contains
a list. Tags is my list and I have three values in it one, two and three.

tags : ["one", "two", "three"]

If I do a search for "two" I would like to only return the "two" in the
value in the results.

I understand that a nested type is the way to go. The field "tag" is a
multi field property as I'm analysing it in multiple ways. I having trouble
getting a nested type working with a with a multi-field property. Here is
the mapping of the tags at the moment:

{
"document": {
"properties": {
"tags":{
"type": "multi_field",
"fields":{
"tags" {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}

--
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.
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hello,

Ah, right. Parent-child doesn't seem like a good fit in this case.

I said highlighting earlier, but I don't think it works with nested
documents. At least not at the time of this thread:
http://elasticsearch-users.115913.n3.nabble.com/Highlighting-on-nested-documents-if-include-in-parent-is-set-to-true-td4021717.html

So maybe you'll have to look at that array from your application.

On Sun, Jun 16, 2013 at 10:03 PM, es newbie dan.tuffery@gmail.com wrote:

Hi Radu,

I'm not sure the the child/parent mapping is the way to go.

The tags field is indexed in multiple ways, so I need to to be a
multi_valued field. I want to return all values in the tag array for some
queries. For an autocomplete search I only want to return the value in the
array that is a match, not all of the values in the array. I also don't
want to have to index the document fields twice, once for the document and
once for the tags. Can I not do what I want with a nested type?

On Sunday, June 16, 2013 1:33:27 PM UTC+1, es newbie wrote:

Thanks I'll take a look at that.

On Sunday, June 16, 2013 12:59:07 PM UTC+1, Radu Gheorghe wrote:

Hello,

If you only need the "two" returned (and only that), I guess you'll need
parent-child relationships. Here are some references:
Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.elasticsearch.org/guide/reference/mapping/parent-field/
Elasticsearch Platform — Find real-time answers at scale | Elastic**
child-query/http://www.elasticsearch.org/guide/reference/query-dsl/has-child-query/
Elasticsearch Platform — Find real-time answers at scale | Elastic**
parent-query/http://www.elasticsearch.org/guide/reference/query-dsl/has-parent-query/

If you only need to highlight, the "two" there, you'd probably need
highlighting:
Elasticsearch Platform — Find real-time answers at scale | Elastic**
highlighting/http://www.elasticsearch.org/guide/reference/api/search/highlighting/

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Sat, Jun 15, 2013 at 8:54 PM, es newbie dan.t...@gmail.com wrote:

I'm trying to return a single value if I search on a field that
contains a list. Tags is my list and I have three values in it one, two and
three.

tags : ["one", "two", "three"]

If I do a search for "two" I would like to only return the "two" in the
value in the results.

I understand that a nested type is the way to go. The field "tag" is a
multi field property as I'm analysing it in multiple ways. I having trouble
getting a nested type working with a with a multi-field property. Here is
the mapping of the tags at the moment:

{
"document": {
"properties": {
"tags":{
"type": "multi_field",
"fields":{
"tags" {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}

--
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.
For more options, visit https://groups.google.com/**groups/opt_outhttps://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.
For more options, visit https://groups.google.com/groups/opt_out.

--
http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

--
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.
For more options, visit https://groups.google.com/groups/opt_out.