How are phrase
and term
different in a Structured
query?
I have this data in my CloudSearch domain:
{
"guid": 9,
"operating_systems": [
"12345", "123"
],
"manufacturer": "sealand",
"model": "gaming tree whale plum",
"identifier": "gaming tree whale plum",
"type": "computer",
"created_at": "1982-10-14T14:43:54Z"
}
"model"
is type text
, "identifier"
is type literal
, "created_at"
is type date
.
Let's make a few queries:
(phrase field=model 'tree whale') match
(phrase field= identifier 'tree whale') no match
(phrase 'tree whale') match
(phrase field=created_at '1982-10-14T14:43:54Z') match (this shouldn't match according to docs)
(term field=model 'tree whale') match
(term field= identifier 'tree whale') no match
(term 'tree whale') match
(term field=created_at '1982-10-14T14:43:54Z') match
Is there anything I can do with phrase
that I can't do with term
and vice-versa?
phrase
matches exact order andterm
matches if the field contains the search term anywhere. "Sloppy phrases" are possible. Are you looking for any other specific differences? – Damato