如何检查值是否包含字符串
下面是示例数据。我需要搜索Thomas
{
"id": "Accounting 101",
"dataproduct": "E3",
"professor": {
"name": "Thomas Baszo",
"department": "finance",
"facutly_type": "part-time",
"email": "baszot@onuni.com"
},
"students_enrolled": 27,
"course_publish_date": "2015-01-19",
"course_description": "Act 101 is a course from the business school on the introduction to accounting that teaches students how to read and compose basic financial statements"
}
PUT /data/test/2
{
"name": "Accounting 101",
"room": "E3",
"professor": {
"name": "Sachin Baszo",
"department": "finance",
"facutly_type": "part-time",
"email": "baszot@onuni.com"
},
"students_enrolled": 27,
"course_publish_date": "2015-01-19",
"course_description": "Act 101 is a course from the business school on the introduction to accounting that teaches students how to read and compose basic financial statements"
}
答案 0 :(得分:0)
您可以使用query string搜索任何字段。
GET /_search
{
"query": {
"query_string": {
"query": "Thomas"
}
}
}
default_field (可选,字符串)如果查询字符串中未提供任何字段,则为您要搜索的默认字段。
默认为index.query.default_field
索引设置,其默认值为*
。 *
值提取符合条件查询的所有字段,并过滤元数据字段。如果未指定前缀,则将所有提取的字段组合起来以构建查询。