Property “path“=”jast_name”

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Property “path“=”jast_name”

Lenak
Hello.
I tried to work with “path” property and this feature does not work in
the number of cases.
May be there is my mistake in request. I am working with example from
elasticsearch.com
Schema definition
{
    "tweet" : {
        "properties" : {
            "person" : {
                "properties" : {
                    "name" : {
                        "properties" : {
                            "field1" : {
                                "type" : "string",
                                "path" : "full"
                            },
                            "field2" : {
                                "type" : "string",
                                "path" : "full",
                                "index_name" : "field2Index"
                            },
                            "field3" : {
                                "type" : "string",
                                "path" : "just_name"
                            },
                            "field4" : {
                                "type" : "string",
                                "path" : "just_name",
                                "index_name" : "field4Index"
                            }
                        }
                    }
                }
            },
            "message" : {
                "type" : "string"
            }
        }
    }
}


Indexing request
curl -XPUT 'http://localhost:9200/141706779/tweet/797949840' -d '
{
    "tweet" : {
        "person" : {
            "name" : {
                "field1" : "1",
                "field2" : "2",
                "field3" : "3",
                "field4" : "4"
            },
            "message" : "This is a tweet!"
        }
    }
}

Search requests:
curl -XGET 'http://localhost:9200/_search?q=person.name.field1:1'  -
return hits
curl -XGET 'http://localhost:9200/_search?q=person.name.field2:2'-
return hits
curl -XGET 'http://localhost:9200/_search?q=person.name.field2Index:
2'- return hits
curl -XGET 'http://localhost:9200/_search?q=person.name.field3:3'-
return hits
curl -XGET 'http://localhost:9200/_search?q=field3:3'- NO HITS.
So, I can get result when I write search request with full path and
field name or index name.
What is a query to search object by field when field has property
“path“=”jast_name” ?

Thanks
Lena
Reply | Threaded
Open this post in threaded view
|

Re: Property “path“=”jast_name”

kimchy
Administrator
Hi,


  Sorry for the late response. The doc is wrong (it was something that I thought about in a "branch", not sure how it got into the docs, I will fix it). Basically, the path configuration only applies to object type mapping, and applies to all fields within it.

cheers,
shay.banon

On Sun, May 9, 2010 at 8:41 AM, Lenak <[hidden email]> wrote:
Hello.
I tried to work with “path” property and this feature does not work in
the number of cases.
May be there is my mistake in request. I am working with example from
elasticsearch.com
Schema definition
{
   "tweet" : {
       "properties" : {
           "person" : {
               "properties" : {
                   "name" : {
                       "properties" : {
                           "field1" : {
                               "type" : "string",
                               "path" : "full"
                           },
                           "field2" : {
                               "type" : "string",
                               "path" : "full",
                               "index_name" : "field2Index"
                           },
                           "field3" : {
                               "type" : "string",
                               "path" : "just_name"
                           },
                           "field4" : {
                               "type" : "string",
                               "path" : "just_name",
                               "index_name" : "field4Index"
                           }
                       }
                   }
               }
           },
           "message" : {
               "type" : "string"
           }
       }
   }
}


Indexing request
curl -XPUT 'http://localhost:9200/141706779/tweet/797949840' -d '
{
   "tweet" : {
       "person" : {
           "name" : {
               "field1" : "1",
               "field2" : "2",
               "field3" : "3",
               "field4" : "4"
           },
           "message" : "This is a tweet!"
       }
   }
}

Search requests:
curl -XGET 'http://localhost:9200/_search?q=person.name.field1:1'  -
return hits
curl -XGET 'http://localhost:9200/_search?q=person.name.field2:2'-
return hits
curl -XGET 'http://localhost:9200/_search?q=person.name.field2Index:
2'- return hits
curl -XGET 'http://localhost:9200/_search?q=person.name.field3:3'-
return hits
curl -XGET 'http://localhost:9200/_search?q=field3:3'- NO HITS.
So, I can get result when I write search request with full path and
field name or index name.
What is a query to search object by field when field has property
“path“=”jast_name” ?

Thanks
Lena