Tuvimos que volver a crear registry_promotion_condition indexador que tenía un analizador personalizado llamado custom_value_analyzer. Dado que el analizador no configura por el indexador, lo hemos aplicado a través de la llamada api.

POST /registry_promotion_condition/_close
PUT /registry_promotion_condition/_settings
{
  "analysis" : {
          "analyzer" : {
            "condition_value_analyzer" : {
              "type" : "custom",
              "tokenizer" : "punctuation"
            }
          },
          "tokenizer" : {
            "punctuation" : {
              "pattern" : ",",
              "type" : "pattern"
            }
          }
        }
}
POST /registry_promotion_condition/_open

Después de aplicar esto este analizador en desarrollo y ensayo podríamos capturar datos sin problemas usando la siguiente llamada api.

POST /registry_promotion_condition/promotion_conditions/_search
{
  "from": 0,
  "size": 10,
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "promotionDisplayStatus": {
              "value": true,
              "boost": 1
            }
          }
        },
        {
          "match_phrase": {
            "conditionValue": {
              "query": 4242560,
              "analyzer": "condition_value_analyzer",
              "slop": 0,
              "zero_terms_query": "NONE",
              "boost": 0.8
            }
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  },
  "sort": [
    {
      "promotionId": {
        "order": "asc"
      }
    }
  ]
}



pero en vivo no da respuesta vacía. ¿Tienes idea de por qué es esto? ¿Hay alguna configuración para permitir el analizador personalizado

Este es mi mapeo en entorno en vivo

{
  "registry_promotion_condition" : {
    "mappings" : {
      "promotion_conditions" : {
        "properties" : {
          "conditionDataType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionEntityFieldId" : {
            "type" : "long"
          },
          "conditionId" : {
            "type" : "long"
          },
          "conditionStatus" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionValue" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionVersion" : {
            "type" : "long"
          },
          "createYear" : {
            "type" : "long"
          },
          "promotionActiveFrom" : {
            "type" : "date"
          },
          "promotionActiveUntil" : {
            "type" : "date"
          },
          "promotionCode" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionCreatedAt" : {
            "type" : "date"
          },
          "promotionDescription" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDiscountAmount" : {
            "type" : "float"
          },
          "promotionDiscountType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDisplayName" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDisplayStatus" : {
            "type" : "boolean"
          },
          "promotionId" : {
            "type" : "long"
          },
          "promotionMaxDiscountAmount" : {
            "type" : "float"
          },
          "promotionName" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionRuleFile" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionServiceType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionStatus" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionVersion" : {
            "type" : "long"
          },
          "routingKey" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
        }
      }
    }
  }
}
0
Damitha Dayananda 4 nov. 2019 a las 09:50

1 respuesta

Intenta cambiar tus asignaciones de:

 {
  "registry_promotion_condition" : {
    "mappings" : {
      "promotion_conditions" : {
        "properties" : {
          "conditionDataType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionEntityFieldId" : {
            "type" : "long"
          },
          "conditionId" : {
            "type" : "long"
          },
          "conditionStatus" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionValue" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionVersion" : {
            "type" : "long"
          },
          "createYear" : {
            "type" : "long"
          },
          "promotionActiveFrom" : {
            "type" : "date"
          },
          "promotionActiveUntil" : {
            "type" : "date"
          },
          "promotionCode" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionCreatedAt" : {
            "type" : "date"
          },
          "promotionDescription" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDiscountAmount" : {
            "type" : "float"
          },
          "promotionDiscountType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDisplayName" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDisplayStatus" : {
            "type" : "boolean"
          },
          "promotionId" : {
            "type" : "long"
          },
          "promotionMaxDiscountAmount" : {
            "type" : "float"
          },
          "promotionName" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionRuleFile" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionServiceType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionStatus" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionVersion" : {
            "type" : "long"
          },
          "routingKey" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
        }
      }
    }
  }
}

Para (analizador agregado a su campo conditionValue ):

 {
  "registry_promotion_condition" : {
    "mappings" : {
      "promotion_conditions" : {
        "properties" : {
          "conditionDataType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionEntityFieldId" : {
            "type" : "long"
          },
          "conditionId" : {
            "type" : "long"
          },
          "conditionStatus" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "conditionValue" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            },
            "analyzer":"condition_value_analyzer"
          },
          "conditionVersion" : {
            "type" : "long"
          },
          "createYear" : {
            "type" : "long"
          },
          "promotionActiveFrom" : {
            "type" : "date"
          },
          "promotionActiveUntil" : {
            "type" : "date"
          },
          "promotionCode" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionCreatedAt" : {
            "type" : "date"
          },
          "promotionDescription" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDiscountAmount" : {
            "type" : "float"
          },
          "promotionDiscountType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDisplayName" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionDisplayStatus" : {
            "type" : "boolean"
          },
          "promotionId" : {
            "type" : "long"
          },
          "promotionMaxDiscountAmount" : {
            "type" : "float"
          },
          "promotionName" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionRuleFile" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionServiceType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionStatus" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionType" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "promotionVersion" : {
            "type" : "long"
          },
          "routingKey" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
        }
      }
    }
  }
}

Tendrá que eliminar su índice para actualizar su mapeo y reindexar nuevamente. mira mi Respuesta sobre reindexar.

1
Assael Azran 4 nov. 2019 a las 09:54