ElasticSearch 创建的文档无法在索引中查看
ElasticSearch created documents cannot be viewed in the index
我正在使用 liferay 7.3.5 并尝试创建一个 elasticSearch。通过我对 ElasticSearch 的第一次体验,我尝试为数据库中的一个实体编制索引。我正确构建了搜索平台,并在特定节点内以远程模式工作。对于索引,我已按照本教程中的步骤一一进行操作
服务层的Index handling也是这样做的,在debug模式下可以看的很清楚,条目被索引,转换成文档,存储在companyId对应的特殊索引号中在 Liferay 中。
我可以在搜索菜单的本地主机中看到该索引。
问题 是当我在 elasticsearch 中使用 Kibana 或 direkt 在生成的索引中搜索时,我找不到自己的条目。
这是我的 elasticsearch 配置。
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: LiferayElasticsearchCluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["127.0.0.1", "[::1]"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
一些查询,例如:
curl -H 'Content-Type: application/json' -X GET https://localhost:9200/index_name?pretty
仅显示索引中的基本内容,并显示为索引实体创建的 none 个文档。
这里是主要索引内容
{
"took" : 51,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_hpItPms3XD6+xRXITXem4Q==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_hpItPms3XD6+xRXITXem4Q==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "Roma",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_4eLyz9eWq/ExLH2UIXzyjA==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_4eLyz9eWq/ExLH2UIXzyjA==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "nabla",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_9HJwraB61aNCiyw34D9pKQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_9HJwraB61aNCiyw34D9pKQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "Sancho",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_0M8pwRYwBq1tdRsWqXXSkQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_0M8pwRYwBq1tdRsWqXXSkQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "neonat�logo",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_urh2RmIpestSVBkqxfajlg==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_urh2RmIpestSVBkqxfajlg==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "naturalizar",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_WQdpBH7oN5SfNEhPdkwBCQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_WQdpBH7oN5SfNEhPdkwBCQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "Montesa",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_9Zk1wxijkzSFKbhDYUvLmg==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_9Zk1wxijkzSFKbhDYUvLmg==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "natral",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_/iyA0D3o33rpBLGqAKA+iw==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_/iyA0D3o33rpBLGqAKA+iw==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "nerviosismo",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_MQkMexFs2h9y6qh9lOPvAQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_MQkMexFs2h9y6qh9lOPvAQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "nat�o",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_1QP9Sy8zifQSnSiRfVcvKg==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_1QP9Sy8zifQSnSiRfVcvKg==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "narcolepsia",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
}
]
}
}
还有什么事没做吗?
感谢帮助
我通过清除主索引的内容并重新索引实体来解决问题,因此旧的映射被删除,不再有冲突。因此,文档被保存在索引中。
我正在使用 liferay 7.3.5 并尝试创建一个 elasticSearch。通过我对 ElasticSearch 的第一次体验,我尝试为数据库中的一个实体编制索引。我正确构建了搜索平台,并在特定节点内以远程模式工作。对于索引,我已按照本教程中的步骤一一进行操作
服务层的Index handling也是这样做的,在debug模式下可以看的很清楚,条目被索引,转换成文档,存储在companyId对应的特殊索引号中在 Liferay 中。
我可以在搜索菜单的本地主机中看到该索引。
问题 是当我在 elasticsearch 中使用 Kibana 或 direkt 在生成的索引中搜索时,我找不到自己的条目。
这是我的 elasticsearch 配置。
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: LiferayElasticsearchCluster
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["127.0.0.1", "[::1]"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
一些查询,例如:
curl -H 'Content-Type: application/json' -X GET https://localhost:9200/index_name?pretty
仅显示索引中的基本内容,并显示为索引实体创建的 none 个文档。
这里是主要索引内容
{
"took" : 51,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_hpItPms3XD6+xRXITXem4Q==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_hpItPms3XD6+xRXITXem4Q==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "Roma",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_4eLyz9eWq/ExLH2UIXzyjA==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_4eLyz9eWq/ExLH2UIXzyjA==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "nabla",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_9HJwraB61aNCiyw34D9pKQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_9HJwraB61aNCiyw34D9pKQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "Sancho",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_0M8pwRYwBq1tdRsWqXXSkQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_0M8pwRYwBq1tdRsWqXXSkQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "neonat�logo",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_urh2RmIpestSVBkqxfajlg==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_urh2RmIpestSVBkqxfajlg==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "naturalizar",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_WQdpBH7oN5SfNEhPdkwBCQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_WQdpBH7oN5SfNEhPdkwBCQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "Montesa",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_9Zk1wxijkzSFKbhDYUvLmg==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_9Zk1wxijkzSFKbhDYUvLmg==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "natral",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_/iyA0D3o33rpBLGqAKA+iw==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_/iyA0D3o33rpBLGqAKA+iw==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "nerviosismo",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_MQkMexFs2h9y6qh9lOPvAQ==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_MQkMexFs2h9y6qh9lOPvAQ==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "nat�o",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
},
{
"_index" : "liferay-37710",
"_type" : "LiferayDocumentType",
"_id" : "37710_spellCheckWord_1QP9Sy8zifQSnSiRfVcvKg==",
"_score" : 1.0,
"_source" : {
"uid" : "37710_spellCheckWord_1QP9Sy8zifQSnSiRfVcvKg==",
"companyId" : "37710",
"spellCheckWord_es_ES" : "narcolepsia",
"groupId" : "0",
"languageId" : "es_ES",
"priority" : "0.0",
"type" : "spellChecker"
}
}
]
}
}
还有什么事没做吗?
感谢帮助
我通过清除主索引的内容并重新索引实体来解决问题,因此旧的映射被删除,不再有冲突。因此,文档被保存在索引中。