Search two words in the same sentence

I have got a index that it saved articles. The articles index has got abstract and content field. I have set text type for abstract and content mapping.
I wanna search two words what appear in the same sentence in abstract or content field. And also I must check the slop words between theirs.
How do I do it?

Welcome!

You can't search within sentences if you indexed a full text. You need to split the text by sentence and then index each sentence independently.

Otherwise you can do proximity search but the 2 terms might be in 2 different sentences (last word of one sentence and first word of the next sentence).

1 Like

Thanks for answering me.
I'm splitting sentences. Then, can I get position of token of searched words?
If we get the position of word1 and word2, we can set a filter to compare sentences positions. Is it possible?

Do you have any sample document of what you are describing?