Elasticsearch:简单查询不匹配字段
Elasticsearch: Simple query not matching fields
我想用简单的查询语法查询弹性索引。
我的查询:
{
"query": {
"simple_query_string" : {
"query": "25",
"fields" : ["product.size"]
}
}
}
没有返回任何结果,尽管字段中有一个条目具有匹配值:
{
"took" : 869,
"timed_out" : false,
"_shards" : {
"total" : 2,
"successful" : 2,
"failed" : 0
},
"hits" : {
"total" : 97241,
"max_score" : 1.8576174,
"hits" : [
{
"_index" : "deviceinformation",
"_type" : "deviceinfo",
"_id" : "314043",
"_score" : 1.8576174,
"_source" : {
"baseinfo" : {
"material_no" : "314043",
"dimensional_drawing_nr" : "118600"
},
"product" : {
"size" : "25",
"range" : "I",
"type" : "MAC"
}
}]
}
我做错了什么?
编辑:
我正在使用 Elassandra 5.5.0.18 = Elasticsearch 5.5.0 + Cassandra 3.11.2
映射摘录:
{
"deviceinformation" : {
"mappings" : {
"deviceinfo" : {
"product" : {
"type" : "nested",
"cql_collection" : "singleton",
"cql_udt_name" : "product",
"properties" : {
"base_size" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"pressure_stage" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"range" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"size" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"type" : {
"type" : "keyword",
"cql_collection" : "singleton"
}
}
}
}
试试这个
或者这应该有效
{
"query": {
"nested": {
"path": "product",
"query": {
"match": {
"proucts.size" : "25"
}
}
}
}
}
这个有效:
{
"query": {
"nested": {
"path": "product",
"query": {
"match": {
"product.size": "25"
}
}
}
}
}
我想用简单的查询语法查询弹性索引。
我的查询:
{
"query": {
"simple_query_string" : {
"query": "25",
"fields" : ["product.size"]
}
}
}
没有返回任何结果,尽管字段中有一个条目具有匹配值:
{
"took" : 869,
"timed_out" : false,
"_shards" : {
"total" : 2,
"successful" : 2,
"failed" : 0
},
"hits" : {
"total" : 97241,
"max_score" : 1.8576174,
"hits" : [
{
"_index" : "deviceinformation",
"_type" : "deviceinfo",
"_id" : "314043",
"_score" : 1.8576174,
"_source" : {
"baseinfo" : {
"material_no" : "314043",
"dimensional_drawing_nr" : "118600"
},
"product" : {
"size" : "25",
"range" : "I",
"type" : "MAC"
}
}]
}
我做错了什么?
编辑: 我正在使用 Elassandra 5.5.0.18 = Elasticsearch 5.5.0 + Cassandra 3.11.2 映射摘录:
{
"deviceinformation" : {
"mappings" : {
"deviceinfo" : {
"product" : {
"type" : "nested",
"cql_collection" : "singleton",
"cql_udt_name" : "product",
"properties" : {
"base_size" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"pressure_stage" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"range" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"size" : {
"type" : "keyword",
"cql_collection" : "singleton"
},
"type" : {
"type" : "keyword",
"cql_collection" : "singleton"
}
}
}
}
试试这个
或者这应该有效
{
"query": {
"nested": {
"path": "product",
"query": {
"match": {
"proucts.size" : "25"
}
}
}
}
}
这个有效:
{
"query": {
"nested": {
"path": "product",
"query": {
"match": {
"product.size": "25"
}
}
}
}
}