Any help would be appreciated. I have a parent document that has an array 
of sub documents which are tags that are associated with an objectid which 
is used to identify another element. I am able to search on the tags and 
get a response which returns the parent document which is exactly what I 
want. However, since the tags map to an objectid, I'd like to know which 
keywords matched the tag so I can get the objectid. I can compare the tags 
on the client to figure out which matched, however, if using a stemming 
analyzer, this wouldn't work and I'd like to find a better way if possible. 
For example, if I search for "friend and families" I would get a return of 
the document with id 249184, but I want to find out that we matched a tag 
related to objectid='7'. Any suggestions on if I'm going in the right 
direction to get the results I need or would there be another way to 
structure this. 


{
  "_index": "myindex",
  "_type": "mytype",
  "_id": "249184",
  "_version": 1,
  "_score": 1,
  "_source": {
    "id": 249184,
    "info":"I love elasticsearch",
    "mytags": [
      {
        "objectid": 7,
        "tags": [
          "friend and families",
          "brother"
        ]
      },
      {
        "objectid": 3,
        "tags": [
          "sister"
        ]
      }
    ]
  }
}


The index is defined as follows (has been simplified for this example):

{
    "mydata": {
        "properties": {
            "id": {
                "type": "integer",
                "index": "not_analyzed"
            },
            "info": {
                "type": "string",
                "analyzer": "standard"
            },
            "mytags": {
                "type" : "object",
                "properties": {
                    "objectid": { "type": "integer", "index": 
"not_analyzed" },
                    "tags":  { "type": "string", "analyzer": "standard"}
                }
            }
        }
    }
}

Thanks much


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/00fb58c8-dee5-47d5-a463-e754d28d7b33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to