elasticsearch Elasticsearch:简单查询不匹配字段
我想用简单的查询语法查询弹性索引 我的问题是:elasticsearch Elasticsearch:简单查询不匹配字段,elasticsearch,elassandra,elasticsearch,Elassandra,我想用简单的查询语法查询弹性索引 我的问题是: { "query": { "simple_query_string" : { "query": "25", "fields" : ["product.size"] } } } 没有返回结果,尽管字段中有一个具有匹配值的条目: { "took" : 869, "timed_out" : false, "_shards" : { "total" : 2, "succe
{
"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"
}
}
}
}
}
您可以发布正在使用的索引和ES版本的映射吗。查询对我来说很好。我在最初的问题中添加了映射和版本,但没有尝试。现在有点忙。很高兴听到你的反馈,谢谢。没有-没有结果耶,也更正了我的答案。不知怎的错过了添加“产品”的关键名称。谢谢。但是为什么简单的一个失败了呢?因为映射。产品映射定义为嵌套映射。