简体   繁体   中英

ElasticSearch created documents cannot be viewed in the index

i'm using liferay 7.3.5 und try to creat an elasticSearch. Through my first experience in ElasticSearch, I tried to index one of the entities I have in the database. I built the search platform properly and work with in remote mode within a specific node. For indexing I have followed the steps one by one in this tutorial

Creating a Guestbook Indexer

Also Index handling in the service layer did it as well and it works fine and in debug mode this can be seen clearly, entries are indexed, converted into documents, and stored in the special index number that corresponds to the companyId in Liferay.

I can see that index in the local host in the search menu.

The problem is that when I search within the generated index using Kibana or direkt in elasticsearch, I do not find my own entries.

Here is my elasticsearch config.

# ======================== 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

some query such as:

curl -H 'Content-Type: application/json' -X GET https://localhost:9200/index_name?pretty

only show the basic content in the index, and none of the documents created for the indexed entity appear.

Here is the main index content

{
  "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"
        }
      }
    ]
  }
}

Is there still something missing to do?

Thanks for help

I was able to solve the problem by clearing the content of the main index and re-indexing the entity, and thus the old mappings were erased and there was no longer a conflict. Therefore, the documents were saved inside the index.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM