小编bet*_*o86的帖子

Elasticsearch:文档大小和查询性能

我有一个ES索引,中等大小的文档(15-30 Mb或多或少).

每个文档都有一个布尔字段,大多数时候用户只想知道特定文档ID是否将该字段设置为true.

文档大小会影响此查询的性能吗?

   "size": 1,
   "query": {
      "term": {
         "my_field": True
      }
   },
   "_source": [
      "my_field"
   ]
Run Code Online (Sandbox Code Playgroud)

并且"大小":0查询会产生更好的时间性能吗?

elasticsearch

9
推荐指数
1
解决办法
1180
查看次数

Vega和Kibana-动态时间戳标签和过滤查询

我正在使用Kibana进行我的第一个Vega可视化工作。

{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  title: Event counts from all indexes

  data: {
    url: {

      %context%: true
      %timefield%: last_submission

      index: test_info

      body: {
        aggs: {
          time_buckets: {
            date_histogram: {

              field: last_submission
              interval: {%autointerval%: true}
              extended_bounds: {
                min: {%timefilter%: "min"}
                max: {%timefilter%: "max"}
              }

              min_doc_count: 0
            }
          }
        }
        size: 0
      }
    }
    format: {property: "aggregations.time_buckets.buckets"}
  }

  mark: line

  encoding: {
    x: {
      field: key
      type: temporal
      axis: {title: false} 
    }
    y: {
      field: doc_count
      type: quantitative
      axis: {title: "Document count"}
    } …
Run Code Online (Sandbox Code Playgroud)

elasticsearch vega kibana

9
推荐指数
0
解决办法
539
查看次数

最小值应匹配筛选查询

是否有可能有这样的查询

  "query": {
  "filtered": {
     "filter": {
        "terms": {
           "names": [
             "Anna",
             "Mark",
             "Joe"
           ],
           "execution" : "and"
        }
      }
    }
  } 
Run Code Online (Sandbox Code Playgroud)

随着"minimum_should_match": "2"声明?

我知道我可以使用一个简单的查询(我已经尝试过,它有效)但我不需要计算得分.我的目标是过滤包含2个值的文档.

分数通常会严重影响检索文档所需的时间吗?

使用此查询:

  "query": {
  "filtered": {
     "filter": {
        "terms": {
           "names": [
             "Anna",
             "Mark",
             "Joe"
           ],
           "execution" : "and",
           "minimum_should_match": "2"
        }
      }
    }
  } 
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

QueryParsingException[[my_db] [terms] filter does not support [minimum_should_match]]
Run Code Online (Sandbox Code Playgroud)

elasticsearch

8
推荐指数
1
解决办法
2万
查看次数

Elasticsearch更多像这样没有结果

我试图找出更多像这个查询的工作原理(ES 2.X).我用术语向量创建了以下索引.

PUT /test_index
{
   "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0
   },
   "mappings": {
      "doc": {
         "properties": {
            "text": {
               "type": "string",
               "term_vector": "yes"
            }
         }
      }
   }
}

PUT /test_index/doc/1
{
    "text": ["Hello","World"]
}

PUT /test_index/doc/2
{
    "text": ["This","is","me"]
}

PUT /test_index/doc/3
{
    "text": ["Hello","World"]
}

PUT /test_index/doc/4
{
    "text": ["Hello","World","World"]
}
Run Code Online (Sandbox Code Playgroud)

为什么以下查询不返回任何结果?使用第二个查询,我希望至少检索doc 3,它具有相同的doc 1值.

POST /test_index/doc/_search
{
   "query": {
      "more_like_this": {
         "like": "Hello",
         "min_term_freq": 1
      }
   }
}

POST /test_index/doc/_search
{
   "query": {
      "more_like_this": {
         "fields": [
            "text" …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

7
推荐指数
1
解决办法
2180
查看次数

Elasticsearch - 对嵌套对象列表进行脚本过滤

我试图弄清楚如何解决我的 ES 5.6 索引遇到的这两个问题。

"mappings": {
    "my_test": {
        "properties": {
            "Employee": {
                "type": "nested",
                "properties": {
                    "Name": {
                        "type": "keyword",
                        "normalizer": "lowercase_normalizer"
                    },
                    "Surname": {
                        "type": "keyword",
                        "normalizer": "lowercase_normalizer"
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要创建两个单独的脚本过滤器:

1 - 过滤员工数组大小为 == 3 的文档

2 - 过滤数组的第一个元素具有“名称”==“约翰”的文档

我试图迈出一些第一步,但我无法遍历列表。我总是有一个空指针异常错误。

{
  "bool": {
    "must": {
      "nested": {
        "path": "Employee",
        "query": {
          "bool": {
            "filter": [
              {
                "script": {
                  "script" :     """

                   int array_length = 0; 
                   for(int i = 0; i < params._source['Employee'].length; i++) 
                   { …
Run Code Online (Sandbox Code Playgroud)

elasticsearch elasticsearch-painless

5
推荐指数
1
解决办法
2970
查看次数

Elasticsearch query_string命中字段

是否可以使用以下查询检索命中字段名称?

"query": {
  "query_string": {
     "query": "the quick brown fox"
  }
}
Run Code Online (Sandbox Code Playgroud)

文件说

"默认为index.query.default_field索引设置,默认为_all."

但我需要的是正确的命中字段名称.

elasticsearch

1
推荐指数
1
解决办法
1441
查看次数