Your first one is right, but the second is also G Ionian, but since the emphasis is placed on the E, it can be viewed as E Aeolian instead of G Ionian (all of this assumes you are playing over chords from the G Major scale).
To be playing in G Aeolian, you'd need to be playing a Bb and Eb and F natural in your lead over a chord found in the G Aeolian chords (also the chords found in Bb Ionian).
G Ionian = G, A, B, C, D, E, F#
E Aeolian = E, F#, G, A, B, C, D (same as G Ionian)
G Aeolian = G, A, Bb, C, D, Eb, F
Notice I am emphasizing the chords you're playing over. If you're playing the notes G, A, B, C, D, E, and F#, that's G Ionian, which = A Dorian, which = B Phyrgian, which = C Lydian, etc. Focusing on the G sounds different depending on the chord you're playing over. If you're playing over a G chord it's the root, over an A Minor chord it's the 7th, over a D chord it's the 4th (or 11th), over a C chord it's the 5th, etc...
The chord progression defines the mode. If the chord progression is G, C, D, G, then you're playing in G Ionian. If you play in E Aeolian, it'll sound just like G Ionian because of the chords. Playing in G Ionian over Em, D, C, D will sound just like E Aeolian because the chord progression is E Aeolian. Get it?
If you want to understand about switching modes mid progression, record yourself playing a G5 chord for a minute or two. Now play this back. First play the G Lydian (G, A, B, C#, D, E, F#) scale up and down and listen to it. Then play G Ionian (G, A, B, C, D, E, F#), then G Mixolydian (G, A, B, C, D, E, F), then G Dorian(G, A, Bb, C, D, E, F), then G Aeolian (G, A, Bb, C, D, Eb, F), then G Phyrgian (G, Ab, Bb, C, D, Eb, F), and lastly G Locrian (G, Ab, Bb, C, Db, Eb, F), although Locrian won't sound right since it has a diminished 5th and you're playing over a perfect 5th. This will get the sound of each mode in your head. Notice the defining notes of each mode.
Mode Defining Note(s)
-------------------------------
Lydian #4
Ionian 4
Mixolydian b7
Dorian 6
Aeolian b6
Phyrgian b2
Locrian b5
Applying these defining notes - playing over an A Aeolian chord progression (Am, G, F, G) it sometimes sounds good to play a Bb, perhaps then sliding up to B. This is drawing a note out of A Phyrgian and using it over an A Aeolian progression. Sure it sounds slightly "out", but if that's the sound you're going for... also, it sounds good sometimes to use F# over an A Aeolian progression, which is drawing the natural 6 from A Dorian. In General, you can play whatever note you want, but if it's not from the mode of the chord progression, then you probably want to just use it as a passing note. Use your ear as the final judge, and sorry for the super long winded post.
If any of this info isn't right, somebody please tell me. I wrote a lot, so I'm sure I messed something up :)
"You must stab him in the heart with the Bone Saber of Zumacalis... well, you could stab him in the head or the lungs, too... and the saber, it probably doesn't have to be bone, just anything sharp lying around the house... you could poke him with a pillow and kill him."
- Aqua Teen Hunger Force, The Universal Re-Monster