Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch Elasticsearch:使用index1中的不同参数在index2上迭代运行查询_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Kubernetes_Kibana - Fatal编程技术网 elasticsearch Elasticsearch:使用index1中的不同参数在index2上迭代运行查询,elasticsearch,kubernetes,kibana,elasticsearch,Kubernetes,Kibana" /> elasticsearch Elasticsearch:使用index1中的不同参数在index2上迭代运行查询,elasticsearch,kubernetes,kibana,elasticsearch,Kubernetes,Kibana" />

elasticsearch Elasticsearch:使用index1中的不同参数在index2上迭代运行查询

elasticsearch Elasticsearch:使用index1中的不同参数在index2上迭代运行查询,elasticsearch,kubernetes,kibana,elasticsearch,Kubernetes,Kibana,我在elasticsearch中有两个索引(~表:index1和index2) 对于index1中的每个文档,我希望在index2中找到最相似的文档,并将结果中的一个字段存储为index1中的一个字段 我有一个查询,可以根据余弦相似性为给定的query\u嵌入查找最相似的文档: GET company-embedding/_search { "from" : 0, "size" : 1, &

我在elasticsearch中有两个索引(~表:index1和index2)

对于index1中的每个文档,我希望在index2中找到最相似的文档,并将结果中的一个字段存储为index1中的一个字段

我有一个查询,可以根据余弦相似性为给定的
query\u嵌入
查找最相似的文档:

GET company-embedding/_search

{
                "from" : 0, "size" : 1,
                "query": {
                    "script_score": {
                        "query": {
                            "match_all": {}
                        },
                        "script": {
                            "source": "cosineSimilarity(params.query_embedding, doc['name_embedding']) + 1.0",
                            "params": {
                                "query_embedding": query_embedding
                            }
                        }
                    }
                }
            }
query\u embedding
的值实际上是index1中的一个字段,我希望elasticsearch执行以下操作:

  • 对于index1中的每个文档,运行上面的查询并将doc['query\u embedding']作为参数传递
  • 存储结果(最好作为index1中的字段)
  • 如果无法将结果存储在index1中的字段中,我很高兴听到任何解决方法