<p dir="auto">I have two indexes, the first one called <strong>areas</strong> is an index containing of multiple polygons, and second one is an index containing of multiple <strong>points</strong> indicating  the document's lat/lon on earth, the index is called <strong>stores</strong>.</p>
<p dir="auto">The problem is that I want to attach areas(polygons) that contain the <strong>store's point</strong> (lat/lon) inside of them, to the store's document as an embedded object. So I can easily find that a document on <strong>stores</strong> index has which areas.</p>
<p dir="auto">In an <strong>RDBMS</strong> I was able to join this two table and find the needed records, In elasticsearch I can iterate over <strong>areas</strong> index documents one by one and perform a query to find the <strong>stores</strong> that fit in the <strong>area's</strong> polygon, and then perform an update on the <strong>store</strong> document, as the number of <strong>areas</strong> are huge, I have to perform over 50,000 queries on elasticsearch.</p>
<p dir="auto">A good solution would be sending a bulk list of areas with the query and tell elasticsearch to aggregate returning results by them the answer would be something like this:</p>
<ul dir="auto">
<li>Polygon A : [store1, store2, store3],</li>
<li>Polygon B : [store1, store4, store5]</li>
</ul>
<p dir="auto">I didn't find anyway to implement this and I switched back to RDBMS solution which is not very optimized and fast too, but it is faster in design.</p>
<p dir="auto">Is there anyway to implement this with elasticsearch?</p>
<p dir="auto">I also planned for writing a plugin which does this functionality if it is not possible currently.</p>
<p dir="auto">Hi !<br>
I have the same issue that the one exposed here : <a href="https://github.com/elastic/elasticsearch/issues/12819" data-hovercard-type="issue" data-hovercard-url="/elastic/elasticsearch/issues/12819/hovercard">#12819 </a> (before closing due to the lack of feedback asked by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/clintongormley/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/clintongormley">@clintongormley</a> to the author <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/apanimesh061/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/apanimesh061">@apanimesh061</a>)</p>
<p dir="auto">I discussed it here <a href="http://stackoverflow.com/questions/37205478/how-to-prevent-duplicate-tokens-with-same-start-pos-but-different-end?noredirect=1#comment61964513_37205478" rel="nofollow">on stackoverflow</a> because I thought I made a mistake in my parameters</p>
<p dir="auto">When using a shingle token filter after removal of stopwords why don't we have a parameter to completely ignore stopwords ?<br>
There would be two huge benefits for me :</p>
<ul dir="auto">
<li>Even with "filler_token":"" (or "filler_token":" " then a "trim" token filter) there are duplicated shingles generated, with the same text, "pos" and "start" but only differing by "end" that might tweak the queries scores for the duplicated words as seen <a href="http://i.stack.imgur.com/nboTe.png" rel="nofollow">here :</a></li>
<li>If a word is surrounded by stopwords, no shingles would be generated associating it with other words around, several (deleted) stopwords away...</li>
</ul>
<p dir="auto">I shall add that those duplicated tokens are not removed by a "unique" token filter... and that I don't understand why.</p>
<p dir="auto">Here is my analysis (I only kept the "test" analyzer which I used to generate examples but I have a few others ):</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;settings&quot;: {
    &quot;index&quot;: {
        &quot;analysis&quot;: {
            &quot;filter&quot;: {
                &quot;fr_stop&quot;: {
                    &quot;ignore_case&quot;: &quot;true&quot;,
                    &quot;remove_trailing&quot;: &quot;true&quot;,
                    &quot;type&quot;: &quot;stop&quot;,
                    &quot;stopwords&quot;: &quot;_french_&quot;
                },
                &quot;fr_worddelimiter&quot;: {
                    &quot;type&quot;: &quot;word_delimiter&quot;,
                    &quot;language&quot;: &quot;french&quot;
                },
                &quot;fr_snowball&quot;: {
                    &quot;type&quot;: &quot;snowball&quot;,
                    &quot;language&quot;: &quot;french&quot;
                },
                &quot;custom_nGram&quot;: {
                    &quot;type&quot;: &quot;ngram&quot;,
                    &quot;min_gram&quot;: &quot;3&quot;,
                    &quot;max_gram&quot;: &quot;10&quot;
                },
                &quot;custom_shingles&quot;: {
                    &quot;max_shingle_size&quot;: &quot;4&quot;,
                    &quot;min_shingle_size&quot;: &quot;2&quot;,
                    &quot;token_separator&quot;: &quot; &quot;,
                    &quot;output_unigrams&quot;: &quot;true&quot;,
                    &quot;filler_token&quot;:&quot;&quot;,
                    &quot;type&quot;: &quot;shingle&quot;
                },
                &quot;custom_unique&quot;: {
                    &quot;type&quot;: &quot;unique&quot;,
                    &quot;only_on_same_position&quot;: &quot;true&quot;
                },
                &quot;fr_elision&quot;: {
                    &quot;type&quot;: &quot;elision&quot;,
                    &quot;articles&quot;: [
                        &quot;l&quot;,
                        &quot;m&quot;,
                        &quot;t&quot;,
                        &quot;qu&quot;,
                        &quot;n&quot;,
                        &quot;s&quot;,
                        &quot;j&quot;,
                        &quot;d&quot;,
                        &quot;c&quot;,
                        &quot;jusqu&quot;,
                        &quot;quoiqu&quot;,
                        &quot;lorsqu&quot;,
                        &quot;puisqu&quot;,
                        &quot;parce qu&quot;,
                        &quot;parcequ&quot;,
                        &quot;entr&quot;,
                        &quot;presqu&quot;,
                        &quot;quelqu&quot;
                    ]
                }
            },
            &quot;charfilter&quot;: &quot;html_strip&quot;,
            &quot;analyzer&quot;: {
                &quot;test&quot;: {
                    &quot;filter&quot;: [
                        &quot;asciifolding&quot;,
                        &quot;lowercase&quot;,
                        &quot;fr_stop&quot;,
                        &quot;fr_elision&quot;,
                        &quot;custom_shingles&quot;
                        &quot;trim&quot;,
                        &quot;custom_unique&quot;,
                    ],
                    &quot;type&quot;: &quot;custom&quot;,
                    &quot;tokenizer&quot;: &quot;standard&quot;
                }
            },
            &quot;tokenizer&quot;: {
                &quot;custom_edgeNGram&quot;: {
                    &quot;token_chars&quot;: [
                        &quot;letter&quot;,
                        &quot;digit&quot;
                    ],
                    &quot;min_gram&quot;: &quot;3&quot;,
                    &quot;type&quot;: &quot;edgeNGram&quot;,
                    &quot;max_gram&quot;: &quot;20&quot;
                },
                &quot;custom_nGram&quot;: {
                    &quot;token_chars&quot;: [
                        &quot;letter&quot;,
                        &quot;digit&quot;
                    ],
                    &quot;min_gram&quot;: &quot;3&quot;,
                    &quot;type&quot;: &quot;nGram&quot;,
                    &quot;max_gram&quot;: &quot;20&quot;
                }
            }
        }
    }
}"><pre class="notranslate"><span class="pl-ent">"settings"</span>: {
    <span class="pl-ent">"index"</span>: {
        <span class="pl-ent">"analysis"</span>: {
            <span class="pl-ent">"filter"</span>: {
                <span class="pl-ent">"fr_stop"</span>: {
                    <span class="pl-ent">"ignore_case"</span>: <span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"remove_trailing"</span>: <span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>stop<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"stopwords"</span>: <span class="pl-s"><span class="pl-pds">"</span>_french_<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"fr_worddelimiter"</span>: {
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>word_delimiter<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"language"</span>: <span class="pl-s"><span class="pl-pds">"</span>french<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"fr_snowball"</span>: {
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>snowball<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"language"</span>: <span class="pl-s"><span class="pl-pds">"</span>french<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"custom_nGram"</span>: {
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>ngram<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"min_gram"</span>: <span class="pl-s"><span class="pl-pds">"</span>3<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"max_gram"</span>: <span class="pl-s"><span class="pl-pds">"</span>10<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"custom_shingles"</span>: {
                    <span class="pl-ent">"max_shingle_size"</span>: <span class="pl-s"><span class="pl-pds">"</span>4<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"min_shingle_size"</span>: <span class="pl-s"><span class="pl-pds">"</span>2<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"token_separator"</span>: <span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"output_unigrams"</span>: <span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"filler_token"</span>:<span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>shingle<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"custom_unique"</span>: {
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>unique<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"only_on_same_position"</span>: <span class="pl-s"><span class="pl-pds">"</span>true<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"fr_elision"</span>: {
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>elision<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"articles"</span>: [
                        <span class="pl-s"><span class="pl-pds">"</span>l<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>m<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>t<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>qu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>n<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>s<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>j<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>d<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>c<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>jusqu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>quoiqu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>lorsqu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>puisqu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>parce qu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>parcequ<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>entr<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>presqu<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>quelqu<span class="pl-pds">"</span></span>
                    ]
                }
            },
            <span class="pl-ent">"charfilter"</span>: <span class="pl-s"><span class="pl-pds">"</span>html_strip<span class="pl-pds">"</span></span>,
            <span class="pl-ent">"analyzer"</span>: {
                <span class="pl-ent">"test"</span>: {
                    <span class="pl-ent">"filter"</span>: [
                        <span class="pl-s"><span class="pl-pds">"</span>asciifolding<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>lowercase<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>fr_stop<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>fr_elision<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>custom_shingles<span class="pl-pds">"</span></span>
                        <span class="pl-s"><span class="pl-pds">"</span>trim<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>custom_unique<span class="pl-pds">"</span></span>,
                    ],
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>custom<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"tokenizer"</span>: <span class="pl-s"><span class="pl-pds">"</span>standard<span class="pl-pds">"</span></span>
                }
            },
            <span class="pl-ent">"tokenizer"</span>: {
                <span class="pl-ent">"custom_edgeNGram"</span>: {
                    <span class="pl-ent">"token_chars"</span>: [
                        <span class="pl-s"><span class="pl-pds">"</span>letter<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>digit<span class="pl-pds">"</span></span>
                    ],
                    <span class="pl-ent">"min_gram"</span>: <span class="pl-s"><span class="pl-pds">"</span>3<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>edgeNGram<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"max_gram"</span>: <span class="pl-s"><span class="pl-pds">"</span>20<span class="pl-pds">"</span></span>
                },
                <span class="pl-ent">"custom_nGram"</span>: {
                    <span class="pl-ent">"token_chars"</span>: [
                        <span class="pl-s"><span class="pl-pds">"</span>letter<span class="pl-pds">"</span></span>,
                        <span class="pl-s"><span class="pl-pds">"</span>digit<span class="pl-pds">"</span></span>
                    ],
                    <span class="pl-ent">"min_gram"</span>: <span class="pl-s"><span class="pl-pds">"</span>3<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>nGram<span class="pl-pds">"</span></span>,
                    <span class="pl-ent">"max_gram"</span>: <span class="pl-s"><span class="pl-pds">"</span>20<span class="pl-pds">"</span></span>
                }
            }
        }
    }
}</pre></div>