In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "how to achieve elasticsearch java client action". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to achieve elasticsearch java client action" can help you solve the problem.
Most of the operations in elasticsearch are through the corresponding action, and these action are in the action package. Its structure is shown in the following figure:
The image above is a partial screenshot of the action package, which is faced with the action of each function. The packages for each action are also very similar to index. The implementations of these action are also very similar, all based on action. The following figure shows the inheritance relationship of indexaction:
Because these action do not really implement the corresponding function, but just a proxy, so the implementation is also very simple. Their main role is to provide methods for creating new response and request and their corresponding action names. Also take indexaction as an example, and its method diagram is as follows:
You can see that it simply provides two new response and request methods, and a word NAME field that will be used in later action calls. The corresponding function implementation of each action is in the corresponding transportAction.
These tansportAction inherits the TransportAction interface. When the client invokes the relevant interface of client, client sends the request to the execute of transportAction. The TransportAction of each function implements the doExecute method, and the logic of the function is implemented in this method, which is not mentioned here. The corresponding implementation will be seen in the later function analysis.
There is a piece of code in the client analysis:
TransportAction transportAction = actions.get ((ClientAction) action) its function is to get TransportAction based on action. Because action is just an agent. These associations are implemented in ActionModule, and the code is as follows:
RegisterAction (NodesInfoAction.INSTANCE, TransportNodesInfoAction.class); registerAction (NodesStatsAction.INSTANCE, TransportNodesStatsAction.class); registerAction (NodesShutdownAction.INSTANCE, TransportNodesShutdownAction.class); registerAction (NodesRestartAction.INSTANCE, TransportNodesRestartAction.class); registerAction (NodesHotThreadsAction.INSTANCE, TransportNodesHotThreadsAction.class); registerAction (ClusterStatsAction.INSTANCE, TransportClusterStatsAction.class); registerAction (ClusterStateAction.INSTANCE, TransportClusterStateAction.class); registerAction (ClusterHealthAction.INSTANCE, TransportClusterHealthAction.class)
This is only a small part, and you can see that the corresponding action and TransportAction are bound in module. In this way, when client needs to receive a request, it will find the corresponding action instance according to the tansportAction instance, and the final request will be processed under them.
This is the end of the content about "how to implement elasticsearch java client action". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.