Inner Join Using Federate

Hi Guys,
I am trying to filter a result from indexA using a record from lookup indexB. ie the foreign key from document in indexA should match with a field inside a record in indexB. Where i can specify the id of record. And then match with id of a specific field and foreign key.

	{"join" : {
    			"indices" : ["indexB"],
    			"on" : ["userId", "<StaticRecordID>.id"], 
    			"request" : {
    				 "query" : {
    				 "bool":	 {
        					 "must" :[ {"term" : {
        								  "someCondition" : true
        								 }}
    								 ]
        						}
        					}
    			 }
    }

I need to match foreign key of document in indexA (userId) with field id inside a record of static id say 121

Hi,

I am not sure I fully understand the question,
but if you want to restrict the documents of index B to something very specific, e.g., a record with a static_id equals to 121, then you can add a filter clause to the nested request. See below.
You can then use the join clause in order to filter documents from index A based on documents from index B with a matching correspondence between the foreign key userId and the id,

{
  "join": {
    "indices": [
      "indexB"
    ],
    "on": [
      "userId",
      "id"
    ],
    "request": {
      "query": {
        "bool": {
          "must": [
            {
              "term": {
                "static_id": 121
              }
            },
            {
              "term": {
                "someCondition": true
              }
            }
          ]
        }
      }
    }
  }
}

@renaud.delbru No, I wanted to restrict based on a field out side the joined records. And i have solved it by reversing the way I am indexing the lookup index.So that the static ID comes inside the joined records. Thanks anyways.