Problem with Fields in Search API

Hi,

I'm trying to run a query with a specific field selection like this:

{
"fields": [ "appointments.time" ],
"query": {
"match": { "appointments.name" : "John" }
}
}

The document I'm querying looks like this:

{
"appointments": [
{
"name": "John",
"time": "2013-03-14T12:30:00Z"
},
{
"name": "Katherine",
"time": "2013-03-20T09:45:00Z"
}
]
}

If the mapping for appointments.time has store set to yes, this doesn't seem to return any fields. My mapping looks like this:

{
"properties": {
'appointments.time': {
'store': 'yes',
'type': 'date',
'format': 'dateOptionalTime'
},
}
}

If I change store to no, then it works as expected.

Is this a bug, or am I doing something wrong (I'm using version 0.20.5)?

Btw, as an aside, is there any way to ask it to return only the fields in the list entries that matched the query?

Thanks,
Frank.

It's not a bug, it's Elasticsearch getting confused between a field with
the name "appointments.time" on the top level and a field "time" inside the
field "appointment". I am not sure if this explanation makes sense, but you
can fix the issue by specifying mapping like this:

        "properties": { 
            "appointments"{
                "properties": {
                    "time": { 
                        "store": "yes", 
                        "type": "date", 
                        "format": "dateOptionalTime"
                    }                    
                }
            }
        } 

On Friday, March 22, 2013 3:32:43 PM UTC-4, Frank Budinsky wrote:

Hi,

I'm trying to run a query with a specific field selection like this:

{
"fields": [ "appointments.time" ],
"query": {
"match": { "appointments.name" : "John" }
}
}

The document I'm querying looks like this:

{
"appointments": [
{
"name": "John",
"time": "2013-03-14T12:30:00Z"
},
{
"name": "Katherine",
"time": "2013-03-20T09:45:00Z"
}
]
}

If the mapping for appointments.time has store set to yes, this doesn't
seem
to return any fields. My mapping looks like this:

{
"properties": {
'appointments.time': {
'store': 'yes',
'type': 'date',
'format': 'dateOptionalTime'
},
}
}

If I change store to no, then it works as expected.

Is this a bug, or am I doing something wrong (I'm using version 0.20.5)?

Btw, as an aside, is there any way to ask it to return only the fields in
the list entries that matched the query?

Thanks,
Frank.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Problem-with-Fields-in-Search-API-tp4032206.html
Sent from the Elasticsearch Users mailing list archive at Nabble.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.
For more options, visit https://groups.google.com/groups/opt_out.