gpt4 book ai didi

elasticsearch - Elasticsearch:简单查询不匹配字段

转载 作者:行者123 更新时间:2023-12-03 01:37:28 24 4
gpt4 key购买 nike

我想使用简单的查询语法查询 flex 索引。

我的查询:

{
"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"
}
}
}
}
}

关于elasticsearch - Elasticsearch:简单查询不匹配字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51264427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com