2

在对具有大输入文本(超过 1000 个字符)的弹性文档执行通配符搜索时

我在“开始于”搜索时遇到了这个例外

我从搜索开始,例如:“myinputtext..*” myinputtext = 超过 1000 个字符

详细异常: 抑制:org.elasticsearch.client.ResponseException:方法 [POST],主机 [http://localhost:9200],URI [/index_133/_search?pre_filter_shard_size=128&typed_keys=true&max_concurrent_shard_requests=5&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true&ignore_throttled= true&search_type=dfs_query_then_fetch&batched_reduce_size=512&ccs_minimize_roundtrips=true],状态行 [HTTP/1.1 400 Bad Request] {"error":{"root_cause":[{"type":"query_shard_exception","re​​ason":"未能创建查询:输入自动机太大:1001"}}}]},"status":400}

我的请求样本是:

{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "indexId": {
              "value": 133,
              "boost": 1
            }
          }
        },
        {
          "nested": {
            "query": {
              "bool": {
                "must": [
                  {
                    "wildcard": {
                      "inputTextDetails.searchInput.input.keyword": {
                        "wildcard": "myinputtext sample*",
                        "boost": 1
                      }
                    }
                  }
                ],
                "adjust_pure_negative": true,
                "boost": 1
              }
            },
            "path": "inputTextDetails",
            "ignore_unmapped": false,
            "score_mode": "none",
            "boost": 1
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}

我的 mappings.json 是:

{
  "dynamic_templates": [
    {
      "with_keyword_custom_normalizer": {
        "match_mapping_type": "string",
        "mapping": {
          "type": "text",
          "analyzer": "simple",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 4000,
              "normalizer": "lower_case_normalizer"
            }
          }
        },
        "path_match": "inputTextDetails.searchInput.*"
      }
    }
  ]
}

请建议我您对在大型数据字段中搜索大型输入的想法。谢谢你的帮助。

4

0 回答 0