Must match all tokens without using _all field


(Tinou Bao) #1

My example:

Book

  • name
  • description
  • author

I want to find all books that have the words "red" and "blue" in the name
or description fields. So I do a match w/ operator "OR" against fields name
and description. BUT both red and blue must appear.

name: red
description: blue
author: foo

name: blue
description: red
author: foo

name: blue red
description: blue
author: foo

All books above would match. But this would not match:

name: red
description: pink
author: foo

since it doesn't have blue.

I can do this by also specifying that "red" and "blue" match the "_all"
field (using the AND operator for "red blue". BUT I would like to NOT use
the _all field...
is it possible for me to? Can't figure out how to do this without using the
_all field....

-T

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Clinton Gormley) #2

Have a look at this answer:

On 17 May 2013 00:33, Tinou Bao tinou.bao@gmail.com wrote:

My example:

Book

  • name
  • description
  • author

I want to find all books that have the words "red" and "blue" in the name
or description fields. So I do a match w/ operator "OR" against fields name
and description. BUT both red and blue must appear.

name: red
description: blue
author: foo

name: blue
description: red
author: foo

name: blue red
description: blue
author: foo

All books above would match. But this would not match:

name: red
description: pink
author: foo

since it doesn't have blue.

I can do this by also specifying that "red" and "blue" match the "_all"
field (using the AND operator for "red blue". BUT I would like to NOT use
the _all field...
is it possible for me to? Can't figure out how to do this without using
the _all field....

-T

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(EndaRecar) #3

Hair extensions and hairpieces really can help to improve the looking of people and help to change them a lot hair extensions and hairpieces if choosing the right type and right style of hair wigs for you, of course that you will look and become more and more attractive and also buy cheap hair wigs now is easy as you can just get the ideal style that you want online at online shops now. I have just buy me a bang wigs and it is perfect.


(system) #4