Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are different ways to achieve what you want. I'd say it depends on the way you want to make prefix matches. You can use a <a href="http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html" rel="nofollow">Prefix Query</a> or make <a href="http://www.elasticsearch.org/guide/reference/index-modules/analysis/edgengram-tokenizer.html" rel="nofollow">EdgeNGrams</a> out of the user field and search on it without the need of a prefix query. The first option is a little bit slower, while the second one causes an increasement of your index size since you'd index more terms (the ngrams).</p> <p>If you decide for the prefix query you need to combine different queries together. You can do that using the <a href="http://www.elasticsearch.org/guide/reference/query-dsl/bool-query.html" rel="nofollow">bool query</a>. You just need to decide which queries must match, which ones must not match and which ones should match (if they are optional). You can also give a boost to each query in order to express that prefix matches are more important for example.</p> <p>On the other hand, if you decide to index EdgeNGrams you can use a single <a href="http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html" rel="nofollow">query string</a> and search on different fields giving a different weight to them, like this:</p> <pre><code>{ "query" : { "query_string" : { "fields" : "user.ngrams^3 field1^2 field2", "query" : "query" } } } </code></pre> <p>You also need to take into account that the query string allows you to search for multiple terms (a boolean query is generated out of them) and to use the <a href="http://www.lucenetutorial.com/lucene-query-syntax.html" rel="nofollow">lucene query syntax</a>. Also, the query string is analyzed while the prefix query is not. It all depends on what you need and whether those features are useful for your usecase.</p> <p>Let me know if you need more information.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload