How to get field data from other documents in query?


(Piyush Aggarwal) #1

Hello everyone, I am trying to create a structure for feeds where one user can create feeds and it can see the feeds of the persons whom he/she is following, I have a feed structure mappings like this:

{
"properties": { 
 "key": {
      "type":  "keyword"
    },
"name":  {
      "type":  "keyword"
    },
"annonymous":{
      "type":"boolean"
    },
"email":{
      "type":  "keyword"
    },
"username":{
      "type":  "text"
    },
"fullDesc": {
      "type":  "text"
    },
"shortDesc":  {
      "type":  "text"
    },
"previewImage":  {
      "type":  "keyword"
    }
    "created":{
      "type":"date",
      "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
    }
  }
}

The user Profile structure is like this:

  {
    "dynamic_templates": [
        {
          "result": {
            "path_match": "result.*",
            "mapping": {
              "type": "text",
              "index": false
            }
          }
        }],
      "properties":
       {
            "email":{
              "type":"keyword"
            },
            "searchHere" : {
                "type": "text",
                "analyzer": "english",
                "fields": {
                    "noDecompound": {
                        "type": "text",
                        "analyzer": "simple"
                    },
                    "noStem": {
                        "type": "text",
                        "analyzer": "standard"
                }
            }
           }
        }
}

In the user profile structure the "result.*" fields will contain the data like user profile image and name of the user which is likely to change, to search the user I will put its details in "searchHere" element .

Now when we get the feeds of the users which a particular user is following from we need the details of its followers profile to show the feeds as it will help us to plot the data in front-end easily.

Now what can I do to include the profile fields of the user while getting feeds from the feed type??


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.