{"cf_items":{"aliases":{},"mappings":{"properties":{"CFDocumentURI":{"properties":{"identifier":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"title":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"uri":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}},"CFItemType":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"CFItemTypeURI":{"properties":{"identifier":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"title":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"uri":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}},"educationLevel":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"fullStatement":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"humanCodingScheme":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"identifier":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"lastChangeDateTime":{"type":"date"},"uri":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}},"settings":{"index":{"routing":{"allocation":{"include":{"_tier_preference":"data_content"}}},"number_of_shards":"1","provided_name":"cf_items","creation_date":"1654520558130","number_of_replicas":"1","uuid":"wMIBuI59QoWhR2-p69ER8Q","version":{"created":"7130099"}}}}}
and I want to search inside any field with matching keyword? How can I do that?
I tried below way
array:2 [
"index" => "cfitems-*"
"body" => array:1 [
"query" => array:1 [
"bool" => array:1 [
"should" => array:1 [
0 => array:1 [
"match_all" => array:1 [
0 => "Default"
]
]
]
]
]
]
]
but not working
CodePudding user response:
I don't see you have many fields in your index. you can use the multi-match query which also supports the wildcard in the fields name.
Refer fields with wildcard example from official Elasticsearch document.
CodePudding user response:
use multi-match query
{
"query": {
"multi_match" : {
"query": "Will Smith",
"fields": ["*"] // for all fields or pass in specific fields
}
}
}