BUG: Index with right_index=True or left_index=True merge
- [x] xref #28243 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Hi,

I would expect the output form the merge function as specified in #28243, i.e. if you join right with right_index=True the resulting DataFrame should have the right index.

The documentation says, that the index is passed on if it is part of the merge.

This change broke a few test, which expected in this case that the index was the index which was merged onto the base DataFrame. I fixed them temporarily until I know how to proceed in this case.

Should this as implemented be the desired behavior for the right_index=True case? 

The code is not final, it is just a first draft. I would have to change the tests for good after we decide how to implement this.
> 
> 
> You'll also want to add a whatsnew note

I would like to wait until the solution is final. There are still a few open points in case of outer joins if my change should be the future behavior for left and right joins

I am not sure how to create the target index for an outer join whe the indexes are used in the join condition. My interpretation would be to merge them in case of equal names and create a MultiIndex in case of different names. @phofl if you merge master will have a look This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. @phofl if you can merge master will have a look closing as stale. if you want to continue, pls ping and can re-open.