gpt4 book ai didi

elasticsearch - ElasticSearch对象过滤器不起作用

转载 作者:行者123 更新时间:2023-12-02 22:24:32 24 4
gpt4 key购买 nike

我尝试使用Jest创建映射和索引。
插入一些数据后,我尝试过滤查询,但该查询不起作用。

我有一个像这样的对象映射:

http://localhost:9200/contacts?pretty=true
"contacts" : {
...
"mappings" : {
"contact" : {
"properties" : {
...
"user" : {
"properties" : {
"id" : {
"type" : "long"
},
"uuid" : {
"type" : "string"
}
}
}
}
}

数据:
{
"_index" : "contacts",
"_type" : "contact",
"_id" : "131530ff-d125-47c1-8fae-f48f2def9037",
"_version" : 1,
"found" : true,
"_source":{"id":"131530ff-d125-47c1-8fae-f48f2def9037","shared":false,"favourite":false,"user":{"id":1,"uuid":"AB353469"}}
}

我的查询:
http://localhost:9200/contacts/_search
{
"query":{
"filtered":{
...
"filter":{
"term" : {
"user.uuid" : "AB353469" }
}
}
}
}

响应:
{
"took": 14,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

您能告诉我为什么它不起作用吗?
非常感谢你!

附言:
-Elasticsearch版本:1.7.2

最佳答案

从更改InitiatorUuid映射

              "initiatorUuid" : {
"type" : "string"
}


              "initiatorUuid" : {
"type" : "string",
"index": "not_analyzed"
}

重新创建索引,重新索引文档,然后重试。

关于elasticsearch - ElasticSearch对象过滤器不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33126209/

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