带有 url 数组的 Elasticsearch 术语

阿南德

我使用的是 Elasticsearch 5.5,下面是 Elasticsearch 的索引

[
      {
        "_index" : "corpindex-qa",
        "_type" : "corpdocs-qa",
        "_id" : "5cb468fd35b9db6f2235e4c4",
        "_score" : 1.0,
        "_source" : {
          "Edition" : {
            "Values" : {
              "title" : "new featured parallex"
          }
          },
          "url" : "/demo-inline-component-capability/demo-of-featured-parallex",
          "year" : 2019,
          "author" : "",
          "docdef" : "new-featured-parallex-reference-1"
        }
      },
      {
        "_index" : "corpindex-qa",
        "_type" : "corpdocs-qa",
        "_id" : "5ccfe1dd6948151485158661",
        "_score" : 1.0,
        "_source" : {
          "Edition" : {
            "Values" : {
              "title" : "demo of event careers",
              "description" : "careers"

            }
          },
          "url" : "/demo-inline-component-capability/demo-of-event-card",
          "year" : 2019,
          "author" : "",
          "docdef" : "inline-event-card"
        }
      }]

尝试通过在带有 elasticsearch 客户端模块的 nodejs 上使用带有术语的查询来获取文档。

client.search({
                            index: searchIndex,
                            type: searchType
                            , body: {
                                query: {
                                    terms: {
                                        "url": ["/demo-inline-component-capability/demo-of-featured-parallex","/demo-inline-component-capability/demo-of-event-card"]
                                    }
                                }
                            }
                        });

执行上述操作时获取零文档。

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

这是映射细节,它来自elasticsaerch

{
corpindex-qa: {
aliases: { },
mappings: {
corpdocs-qa: {
properties: {
url: {
type: "text",
fields: {
keyword: {
type: "keyword",
ignore_above: 256
}
}
},
year: {
type: "long"
}
}
}
},
settings: {
index: {
creation_date: "1559900006341",
number_of_shards: "5",
number_of_replicas: "1",
uuid: "xL6PICFARZq6zMZBpm-75A",
version: {
created: "5050399"
},
provided_name: "corpindex-qa"
}
}
}
}

请分享您对我有帮助的想法。

尼尚

由于您试图匹配精确url使用url.keyword而不是url. 将您的查询更新为以下内容:

client.search({
                            index: searchIndex,
                            type: searchType
                            , body: {
                                query: {
                                    terms: {
                                        "url.keyword": ["/demo-inline-component-capability/demo-of-featured-parallex","/demo-inline-component-capability/demo-of-event-card"]
                                    }
                                }
                            }
                        });

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Elasticsearch术语查询值数组

来自分类Dev

Elasticsearch:使用脚本从数组生成术语

来自分类Dev

elasticsearch中数组的重要术语聚合

来自分类Dev

带有术语汇总的Elasticsearch日期直方图报告

来自分类Dev

带有术语汇总的Elasticsearch日期直方图报告

来自分类Dev

带有多个值的Elasticsearch术语过滤器

来自分类Dev

elasticsearch | 查询带有术语和术语不起作用的列表的文档

来自分类Dev

ElasticSearch将字符串数组转换为术语

来自分类Dev

Elasticsearch 6.3.2 术语匹配空数组“加上”其他

来自分类Dev

在ElasticSearch中使用不带映射的带有斜杠的值的术语过滤器

来自分类Dev

包含在带有Elasticsearch的数组搜索中的数组

来自分类Dev

elasticsearch-具有多个条件的术语过滤器

来自分类Dev

ElasticSearch-具有范围的重要术语聚合

来自分类Dev

jQuery,带有URL数组的$ .ajax

来自分类Dev

ElasticSearch术语聚合

来自分类Dev

Elasticsearch查询多个术语

来自分类Dev

Elasticsearch术语与匹配

来自分类Dev

elasticsearch中的术语查询

来自分类Dev

ElasticSearch:bool-must-term(3)等效于带有minimum_should_match 3的旧术语

来自分类Dev

Elasticsearch 将范围和术语连接到同一个数组项

来自分类Dev

带有URL路径的elasticsearch传输客户端

来自分类Dev

Elasticsearch,术语建议者返回

来自分类Dev

Elasticsearch计算忽略空格的术语

来自分类Dev

使用匹配或术语的ElasticSearch查询?

来自分类Dev

在Elasticsearch JS中使用术语

来自分类Dev

Elasticsearch排除多个术语的关联

来自分类Dev

Elasticsearch ILM术语和概念

来自分类Dev

Elasticsearch-术语为空?

来自分类Dev

elasticsearch术语聚合输出键

Related 相关文章

热门标签

归档