Explicit array type in mapping

Hello,

Does anyone know whether it is possible to explicitly specify that a
property is expected to be an array in the mapping?

I know all the properties can be arrays but is it possible to specify
this in the mapping.

The following didn't work:
categories": {
"type": "array",
"properties": {
"code": {
"type": "string"
}
}

}

We can still use custom "_meta" field as a flag, but probably there is
other way?

No, there isn't. But even with that your mapping suggestion will not work
(categories is an array of string values, I assume, so why does it have a
property named code).

On Wed, Sep 28, 2011 at 11:13 AM, Ridvan Gyundogan ridvansg@gmail.comwrote:

Hello,

Does anyone know whether it is possible to explicitly specify that a
property is expected to be an array in the mapping?

I know all the properties can be arrays but is it possible to specify
this in the mapping.

The following didn't work:
categories": {
"type": "array",
"properties": {
"code": {
"type": "string"
}
}

}

We can still use custom "_meta" field as a flag, but probably there is
other way?

Hi Shay,
thanks for the clarification about the type.

About the code property, I actually removed part of the properties for
simplification.

Actually our mapping is:

categories": {
"properties": {
"code": {
"type": "string" ,
"en": "string",
"bg" : "string"
}
}
}

we store the category code and names for several languages so that we
can search on them.

This leads to some duplication but we can live with that.

Do you have other suggestion?

I suppose we could make the "category" parent and inside put the
"products", is this the prefered way in ES?

Currently we put the category inside the products.

On Sep 28, 1:27 pm, Shay Banon kim...@gmail.com wrote:

No, there isn't. But even with that your mapping suggestion will not work
(categories is an array of string values, I assume, so why does it have a
property named code).

On Wed, Sep 28, 2011 at 11:13 AM, Ridvan Gyundogan ridva...@gmail.comwrote:

Hello,

Does anyone know whether it is possible to explicitly specify that a
property is expected to be an array in the mapping?

I know all the properties can be arrays but is it possible to specify
this in the mapping.

The following didn't work:
categories": {
"type": "array",
"properties": {
"code": {
"type": "string"
}
}

}

We can still use custom "_meta" field as a flag, but probably there is
other way?

ups, actually the mapping is:

categories": {
"properties": {
"code": {
"type": "string" ,
} ,
"en": {
"type": "string" ,
} ,
"bg" : {
"type": "string" ,
}
}
}

On Sep 30, 1:33 pm, Ridvan Gyundogan ridva...@gmail.com wrote:

Hi Shay,
thanks for the clarification about the type.

About the code property, I actually removed part of the properties for
simplification.

Actually our mapping is:

categories": {
"properties": {
"code": {
"type": "string" ,
"en": "string",
"bg" : "string"
}
}

}

we store the category code and names for several languages so that we
can search on them.

This leads to some duplication but we can live with that.

Do you have other suggestion?

I suppose we could make the "category" parent and inside put the
"products", is this the prefered way in ES?

Currently we put the category inside the products.

On Sep 28, 1:27 pm, Shay Banon kim...@gmail.com wrote:

No, there isn't. But even with that your mapping suggestion will not work
(categories is an array of string values, I assume, so why does it have a
property named code).

On Wed, Sep 28, 2011 at 11:13 AM, Ridvan Gyundogan ridva...@gmail.comwrote:

Hello,

Does anyone know whether it is possible to explicitly specify that a
property is expected to be an array in the mapping?

I know all the properties can be arrays but is it possible to specify
this in the mapping.

The following didn't work:
categories": {
"type": "array",
"properties": {
"code": {
"type": "string"
}
}

}

We can still use custom "_meta" field as a flag, but probably there is
other way?

Now I am confused, what are you after? I thought you wanted to be able to
mark mapping as array in the mapping definition itself (even though you
don't really need to with elasticsearch). But now there is another question,
though I have not idea what you ask...

On Fri, Sep 30, 2011 at 1:33 PM, Ridvan Gyundogan ridvansg@gmail.comwrote:

Hi Shay,
thanks for the clarification about the type.

About the code property, I actually removed part of the properties for
simplification.

Actually our mapping is:

categories": {
"properties": {
"code": {
"type": "string" ,
"en": "string",
"bg" : "string"
}
}
}

we store the category code and names for several languages so that we
can search on them.

This leads to some duplication but we can live with that.

Do you have other suggestion?

I suppose we could make the "category" parent and inside put the
"products", is this the prefered way in ES?

Currently we put the category inside the products.

On Sep 28, 1:27 pm, Shay Banon kim...@gmail.com wrote:

No, there isn't. But even with that your mapping suggestion will not work
(categories is an array of string values, I assume, so why does it have a
property named code).

On Wed, Sep 28, 2011 at 11:13 AM, Ridvan Gyundogan <ridva...@gmail.com
wrote:

Hello,

Does anyone know whether it is possible to explicitly specify that a
property is expected to be an array in the mapping?

I know all the properties can be arrays but is it possible to specify
this in the mapping.

The following didn't work:
categories": {
"type": "array",
"properties": {
"code": {
"type": "string"
}
}

}

We can still use custom "_meta" field as a flag, but probably there is
other way?