I am writing one query string to match multiple string in one field.
I need to match documents with type server_physical
and has a string
field called cpu
which will contain words like E5
, 2620
and v3
.
This is what I got which will exactly return the documents I need:
"_type:server_physical AND *2620* AND *E5* AND *v3*"
But it's not good because it will also match other fields contain these words. When I add the cpu
field to the query, no document is matched. Like these:
"_type:server_physical AND cpu:*2620* AND cpu:*E5* AND cpu:*v3*"
or this:
"_type:server_physical AND CPU:(*2620* AND *E5* AND *v3*)"
What is the correct way to do the query string? And I cannot find any additional documentation about query string
other than the very short one in elasticsearch official guide which has several sentences about it.
The mapping of this field is:
{
"index": "not_analyzed",
"type": "string"
}