Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Kibana without bundling the JS files

I need to add some custom code to one of the JS files present in the Kibana release zip: https://www.elastic.co/downloads/kibana

Right now, when I run the Kibana I see the following JS files which are minified and bundled:

enter image description here

and it comes from the Kibana's optimize folder:

enter image description here

Is there any way to run the non modified version present at /src location:

enter image description here

My goal is to add a custom querystring param to each search request done via Kibana:

http://localhost:5601/elasticsearch/_msearch

therefore, trying to figure out the exact file which make this request but right now with minified file it seems hard to find that location.

If we have to make some change in any of the existing JS file, the optimize folder has to be deleted so that on next restart of Kibana service the file bundling can take place to acomodate our custom change. This takes enough time which makes the debugging with JS files of Kibana very time consuming.

How to prevent this bundling step so that the JS debugging can become easy with Kibana.

like image 365
Raghav Avatar asked May 17 '19 15:05

Raghav


1 Answers

I believe that the best approach for what you want to achieve is to clone Kibana GitHub repository since trying to work with a minified version of the scripts that Kibana utilizes are nearly impossible, the purpose of minified JS is not to editable but lightweight. Keep in mind that you are going to need to install all the necessary dependencies. All of it is explained on the CONTRIBUTING.md the file available in the official repository.

I could get it up and running with the following commands, but I'm a Linux user, you are going to need to use the equivalent on windows.

# Prepare your environment
# Install node 10.15.2 as specified in the file .node-version
# Install OpenJDK-8
apt-get update && \
  apt-get install -y openjdk-8-jdk && \
  apt-get install -y ant && \
  apt-get clean;

# Setup JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/
export JAVA_HOME

# Install dependencies and run
git clone https://github.com/[YOUR_USERNAME]/kibana.git kibana
cd kibana
npm i yarn -g
yarn kbn bootstrap
yarn start
like image 192
Hector Acosta Avatar answered Nov 07 '22 15:11

Hector Acosta