title: How to match multiple words as token prefixes
body: <p>I'd like to take a query like "jan do" and have it match values like "jane doe", "don janek" -- and of course: "jan do", "do jan".</p>
  
  <p>So the rules I can think of at the moment are:</p>
  
  <ol>
  <li>tokenize the query based on non-alphanumeric values (e.g. whitespace, symbols, punctuation)</li>
  <li>each query token acts as a prefix for matching tokens in the data store</li>
  <li>the order the tokens appear does not matter. It would be nice to prefer "jan do" to "do jan"</li>
  </ol>
  
  <p>So far, I have this mapping</p>
  
  <pre><code>PUT /test
  {
    "settings": {
      "analysis": {
        "analyzer": {
          "my_keyword": {
            "type": "custom",
            "tokenizer": "keyword",
            "filter": [
              "asciifolding",
              "lowercase"
            ]
          }
        }
      }
    },
    "mappings": {
      "question": {
        "properties": {
          "title": {
            "type": "string"
          },
          "answer": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "analyzer": "my_keyword",
                "fields": {
                  "stemmed": {
                    "type": "string",
                    "analyzer": "standard"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>I've been searching things as phrases:</p>
  
  <pre><code>POST /test/_search
  {
    "query": {
      "dis_max": {
        "tie_breaker": 0.7,
        "boost": 1.2,
        "queries": [
          {
            "match": {
              "answer.text": {
                "query": "jan do",
                "type": "phrase_prefix"
              }
            }
          },
          {
            "match": {
              "answer.text.stemmed": {
                "query": "jan do",
                "operator": "and"
              }
            }
          }
        ]
      }
    }
  }
  </code></pre>
  
  <p>And that works okay when things actually start that phrase, but now I want to tokenize the query and treat each token like a prefix.</p>
  
  <p>Is there a way I can do this (probably at query time)?</p>
  
  <p>My other option is to just construct a query like this:</p>
  
  <pre><code>POST test/_search
  {
    "query": {
      "bool": {
        "should": [
          {
            "prefix": {
              "answer.text.stemmed": "jan"
            }
          },
          {
            "prefix": {
              "answer.text.stemmed": "do"
            }
          }
        ]
      }
    }
  }
  </code></pre>
  
  <p>This seems to work, but it doesn't preserve the order of the words. Also, I feel like that's cheating and possibly not the most performant option. What if there were 10 prefixes? 100? I'd like to know whether anyone feels otherwise.</p>