Prefix query with multiple "prefixes"/words

I'm looking for a query so that "foo baz" matches the following documents:
"foobar baz"
"foo baz"
"baz foo"
"foo bazilion"

Basically I'd like to break down the search string into words and look for a
(prefix)match of all words in the index.

currently I'm using this query
'multi_match': {
'query': query_string,
'fields': ['_all'],
'type': 'phrase_prefix',
}
but it only works for a single word. For example a query for "baz foo" (word
order inverted) does not return a result.
(I'm also open for pretty expensive queries if that's necessary - there are
only few searches so functionality wins over raw performance.)

Any suggestions which query type I should use?

Thank you,
Felix

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/538323B7.8020705%40oss.schwarz.eu.
For more options, visit https://groups.google.com/d/optout.

See Prefix OR query with Elasticsearch · GitHub

Jörg

On Mon, May 26, 2014 at 1:21 PM, Felix Schwarz <felix.schwarz@oss.schwarz.eu

wrote:

I'm looking for a query so that "foo baz" matches the following documents:
"foobar baz"
"foo baz"
"baz foo"
"foo bazilion"

Basically I'd like to break down the search string into words and look for
a
(prefix)match of all words in the index.

currently I'm using this query
'multi_match': {
'query': query_string,
'fields': ['_all'],
'type': 'phrase_prefix',
}
but it only works for a single word. For example a query for "baz foo"
(word
order inverted) does not return a result.
(I'm also open for pretty expensive queries if that's necessary - there are
only few searches so functionality wins over raw performance.)

Any suggestions which query type I should use?

Thank you,
Felix

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/538323B7.8020705%40oss.schwarz.eu
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEnvM84vmri-7WXUR8zXV7YsxRyqAhH%2BWaZQ7n5rqnD%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.