Elasticsearch не возвращает результат; - PullRequest
0 голосов
/ 08 октября 2018

logix_item_view_id: ebc1003mb не возвращается, когда я использую поле с пользовательским анализатором, только при поиске исключительно с logix_item_view_id я получаю правильный результат.

Я не понимаю и не знаю, что делать?logix_item_view_id_search должен возвращать похожие коды, основанные на логике ngran, поэтому мой поиск верен по частям, но почему бы не вернуть код ebc1003mb?Выше это мои настройки индекса и свойства отображения

Я создал индекс в elasticksearch со следующими свойствами:

{
"items_production_20181008060000331": {
    "mappings": {
      "item": {
        "dynamic_templates": [
          {
            "string_template": {
              "match": "*",
              "match_mapping_type": "string",
              "mapping": {
                "fields": {
                  "analyzed": {
                    "analyzer": "searchkick_index",
                    "index": true,
                    "type": "text"
                  }
                },
                "ignore_above": 30000,
                "type": "keyword"
              }
            }
          }
        ],
        "properties": {
          "logix_item_view_id": {
            "type": "keyword",
            "fields": {
              "analyzed": {
                "type": "text",
                "analyzer": "searchkick_index"
              }
            },
            "ignore_above": 30000
          },
          "logix_item_view_id_search": {
            "type": "text",
            "analyzer": "velow_word_start_index"
          }
        }
      }
    }
  }
}

С этими настройками:

{
  "items_production_20181008060000331": {
    "settings": {
      "index": {
        "max_ngram_diff": "49",
        "number_of_shards": "5",
        "provided_name": "items_production_20181008060000331",
        "max_shingle_diff": "4",
        "max_result_window": "3000000",
        "creation_date": "1538989200382",
        "analysis": {
          "filter": {
            "searchkick_velow_ngram": {
              "type": "edgeNGram",
              "min_gram": "3",
              "max_gram": "50"
            },
            "searchkick_edge_ngram": {
              "type": "edgeNGram",
              "min_gram": "1",
              "max_gram": "50"
            }
          },
          "analyzer": {
            "searchkick_word_start_index": {
              "filter": [
                "lowercase",
                "asciifolding",
                "searchkick_edge_ngram"
              ],
              "type": "custom",
              "tokenizer": "standard"
            },
            "velow_word_start_index": {
              "filter": [
                "lowercase",
                "asciifolding",
                "searchkick_velow_ngram"
              ],
              "type": "custom",
              "tokenizer": "standard"
            }
          },
          "char_filter": {
            "ampersand": {
              "type": "mapping",
              "mappings": [
                "&=> and "
              ]
            }
          }
        },
        "number_of_replicas": "1",
        "uuid": "Goj0nb3JQguuPjWoE69XTg",
        "version": {
          "created": "6020399"
        }
      }
    }
  },
  "readme": {
    "settings": {
      "index": {
        "creation_date": "1536920464303",
        "number_of_shards": "5",
        "number_of_replicas": "1",
        "uuid": "TfQpl9nDRHufZYT25N4n0Q",
        "version": {
          "created": "6040099"
        },
        "provided_name": "readme"
      }
    }
  }
}

Когда я делаюПри этом поиске я не получаю никаких результатов по элементу, который должен быть первым:

GET items_production/_search?explain
{
    "query": {
        "bool": {
            "must": {
              "multi_match" : {
                "query": "ebc1003mb", 
                "type":  "cross_fields",
                "fields": [
                  "logix_item_view_id^10",
                  "logix_item_view_id_search^9"
                ]
              }
            }
        }
    }
}

Вот что я получаю, когда делаю анализ:

GET items_production/_analyze
{
  "analyzer" : "velow_word_start_index",
  "text" : "ebc1003mb"
}

{
  "tokens": [
    {
      "token": "ebc",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "ebc1",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "ebc10",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "ebc100",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "ebc1003",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "ebc1003m",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    },
    {
      "token": "ebc1003mb",
      "start_offset": 0,
      "end_offset": 9,
      "type": "<ALPHANUM>",
      "position": 0
    }
  ]
}

Но не надоне понимаю, что я делаю не так

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...