Mapping problem

Hi,

I have a json object with an optional list of link objects with an href and
couple of optional fields such as type:

{"tags":[{"href":"http:...."}], "anotherfield":"foo"}

That works fine and I can do term queries on tags.href, which is what I
want.

However, some of my objects don't have tags and in that case the tags field
is not there. In that case I get a

{"error":"Bad request {"error":"MapperParsingException[object mapping
for [post] with array for [tags] tried to parse as array, but got EOF, is
there a mismatch in types for the same field?]","status":400}"}

The mapping for this field is as follows

"tags": {
"properties": {
"href": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"type": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
}

Is there a way to solve this with my mapping or do I have to provide an
empty tags array?

--
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.

Hey Jilles,

I couldnt reproduce the problem with the information available. Can you
provide a gist and the ES version you are using? Are you maybe mixing up
types somewhere (one where this mapping is defined, one where it is not?
Just a rough guess, without being able to look deeper now)

--Alex

On Wed, Mar 27, 2013 at 6:32 PM, Jilles van Gurp jillesvangurp@gmail.comwrote:

Hi,

I have a json object with an optional list of link objects with an href
and couple of optional fields such as type:

{"tags":[{"href":"http:...."}], "anotherfield":"foo"}

That works fine and I can do term queries on tags.href, which is what I
want.

However, some of my objects don't have tags and in that case the tags
field is not there. In that case I get a

{"error":"Bad request {"error":"MapperParsingException[object mapping
for [post] with array for [tags] tried to parse as array, but got EOF, is
there a mismatch in types for the same field?]","status":400}"}

The mapping for this field is as follows

"tags": {
"properties": {
"href": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"type": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
}

Is there a way to solve this with my mapping or do I have to provide an
empty tags array?

--
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.

Hi,

I spend the morning debugging and found the problem. Some of my test code
was putting an object where a string was supposed to go. So, pilot error
:-). But thanks for replying.

Jilles

On Thursday, March 28, 2013 10:04:58 AM UTC+1, Alexander Reelsen wrote:

Hey Jilles,

I couldnt reproduce the problem with the information available. Can you
provide a gist and the ES version you are using? Are you maybe mixing up
types somewhere (one where this mapping is defined, one where it is not?
Just a rough guess, without being able to look deeper now)

--Alex

On Wed, Mar 27, 2013 at 6:32 PM, Jilles van Gurp <jilles...@gmail.com<javascript:>

wrote:

Hi,

I have a json object with an optional list of link objects with an href
and couple of optional fields such as type:

{"tags":[{"href":"http:...."}], "anotherfield":"foo"}

That works fine and I can do term queries on tags.href, which is what I
want.

However, some of my objects don't have tags and in that case the tags
field is not there. In that case I get a

{"error":"Bad request {"error":"MapperParsingException[object mapping
for [post] with array for [tags] tried to parse as array, but got EOF, is
there a mismatch in types for the same field?]","status":400}"}

The mapping for this field is as follows

"tags": {
"properties": {
"href": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
},
"type": {
"type": "string",
"index": "not_analyzed",
"omit_norms": true,
"index_options": "docs"
}
}
}

Is there a way to solve this with my mapping or do I have to provide an
empty tags array?

--
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.