It is possible that the Ebenezer mentioned in 1 Samuel 4:1–22 was at the same location as the Ebenezer from 1 Samuel 7:1–17. Though the site will only be named at a later stage, seeing as the narrative is written after the events, the name of the site is included now.1 In this case the ark narrative begins with a loss at Ebenezer and concludes with a victory at the same place.2 Alternatively there could be two different Ebenezers: one near Aphek, and one near Mizpah.
1 And the word of Samuel came to all Israel.Now Israel went out to battle against the Philistines. They encamped at Ebenezer, and the Philistines encamped at Aphek.