I am a newbie to elastic and use spring boots to interact with elastic.
I have a scenario as below:
inserting a document like A
inserting a document like B ( and this action takes 5m to complete) and I also insert other documents like C and D after but quickly
then I performed searching but I got only A because the B was not completed
after 5m I queried again and got all A B C and D.
it seems that I can't query new data C and D when performing an action insert or update B
so, could you tell me why and how can I fix this case by config or something else?
Thanks.
Refreshes are resource-intensive. To ensure good cluster performance, we recommend waiting for Elasticsearch’s periodic refresh rather than performing an explicit refresh when possible.
If your application workflow indexes documents and then runs a search to retrieve the indexed document, we recommend using the index API's refresh=wait_for query parameter option. This option ensures the indexing operation waits for a periodic refresh before running the search.
Thank you @dadoonet
But when I am inserting perhaps there is a transaction to lock the index, I called _refresh but it didn't work immediately and took a long time and it waited until the insert action finished then it worked
I parsed a PDF 180M to a text and then stored it in the index. is that ok?
I used a default configuration like that
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 16-04-2024 14:12:48
#
# --------------------------------------------------------------------------------
# Enable security features
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.