How to search substring from log field using the scripted fields in painless without regexkibana 5 scripted field for regex matchElasticsearch Painless script get nested field by value?Sort Elasticsearch results based on field valueElasticsearch custom scoring function test null date valuesHow to perform elastic search _update_by_query using painless script - for complex conditionhow to add a new field into a document using painless scriptElastic Search, Painless ScriptingElastic Search Painless Script DocumentHow to get the current entry of a foreach pipeline instruction using painless scripting?Kibana Scripted Painless Field filebeat IIS logs message returning null with values there

I would say: "You are another teacher", but she is a woman and I am a man

Why is Collection not simply treated as Collection<?>

prove that the matrix A is diagonalizable

Why doesn't H₄O²⁺ exist?

Can I use a neutral wire from another outlet to repair a broken neutral?

Can one be a co-translator of a book, if he does not know the language that the book is translated into?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

If a Gelatinous Cube takes up the entire space of a Pit Trap, what happens when a creature falls into the trap but succeeds on the saving throw?

UK: Is there precedent for the governments e-petition site changing the direction of a government decision?

Python: return float 1.0 as int 1 but float 1.5 as float 1.5

Arrow those variables!

Facing a paradox: Earnshaw's theorem in one dimension

Is there a hemisphere-neutral way of specifying a season?

What exploit are these user agents trying to use?

What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?

Why is consensus so controversial in Britain?

Neighboring nodes in the network

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

In Romance of the Three Kingdoms why do people still use bamboo sticks when papers are already invented?

Infinite Abelian subgroup of infinite non Abelian group example

How can I tell someone that I want to be his or her friend?

Stopping power of mountain vs road bike

How do conventional missiles fly?

Twin primes whose sum is a cube



How to search substring from log field using the scripted fields in painless without regex


kibana 5 scripted field for regex matchElasticsearch Painless script get nested field by value?Sort Elasticsearch results based on field valueElasticsearch custom scoring function test null date valuesHow to perform elastic search _update_by_query using painless script - for complex conditionhow to add a new field into a document using painless scriptElastic Search, Painless ScriptingElastic Search Painless Script DocumentHow to get the current entry of a foreach pipeline instruction using painless scripting?Kibana Scripted Painless Field filebeat IIS logs message returning null with values there






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to create to some scripted fields using painless by capturing some "keyword" in the log field, which is a long text field. for example, I have bunch of the log fields:



"Error: Duplicate entry in user1"

"Error: Duplicate entry in user2"

"Error: Duplicate entry in user1"

"Error: Duplicate entry in user3"

"Error: Duplicate entry in user2"

"Error: Duplicate entry in user1"

"Error: Duplicate entry in user3"



The painless I was using:



if (doc['log.keyword'].value == 'Duplicate entry') 
return "match";

return "No match";


to only capture the "Duplicate entry" error message regardless of userID, I am sure I need to use regex to do that. I am just wondering if there is another way to do it without using the regex. Any suggestions.










share|improve this question






























    0















    I am trying to create to some scripted fields using painless by capturing some "keyword" in the log field, which is a long text field. for example, I have bunch of the log fields:



    "Error: Duplicate entry in user1"

    "Error: Duplicate entry in user2"

    "Error: Duplicate entry in user1"

    "Error: Duplicate entry in user3"

    "Error: Duplicate entry in user2"

    "Error: Duplicate entry in user1"

    "Error: Duplicate entry in user3"



    The painless I was using:



    if (doc['log.keyword'].value == 'Duplicate entry') 
    return "match";

    return "No match";


    to only capture the "Duplicate entry" error message regardless of userID, I am sure I need to use regex to do that. I am just wondering if there is another way to do it without using the regex. Any suggestions.










    share|improve this question


























      0












      0








      0








      I am trying to create to some scripted fields using painless by capturing some "keyword" in the log field, which is a long text field. for example, I have bunch of the log fields:



      "Error: Duplicate entry in user1"

      "Error: Duplicate entry in user2"

      "Error: Duplicate entry in user1"

      "Error: Duplicate entry in user3"

      "Error: Duplicate entry in user2"

      "Error: Duplicate entry in user1"

      "Error: Duplicate entry in user3"



      The painless I was using:



      if (doc['log.keyword'].value == 'Duplicate entry') 
      return "match";

      return "No match";


      to only capture the "Duplicate entry" error message regardless of userID, I am sure I need to use regex to do that. I am just wondering if there is another way to do it without using the regex. Any suggestions.










      share|improve this question
















      I am trying to create to some scripted fields using painless by capturing some "keyword" in the log field, which is a long text field. for example, I have bunch of the log fields:



      "Error: Duplicate entry in user1"

      "Error: Duplicate entry in user2"

      "Error: Duplicate entry in user1"

      "Error: Duplicate entry in user3"

      "Error: Duplicate entry in user2"

      "Error: Duplicate entry in user1"

      "Error: Duplicate entry in user3"



      The painless I was using:



      if (doc['log.keyword'].value == 'Duplicate entry') 
      return "match";

      return "No match";


      to only capture the "Duplicate entry" error message regardless of userID, I am sure I need to use regex to do that. I am just wondering if there is another way to do it without using the regex. Any suggestions.







      elasticsearch kibana-5 elasticsearch-painless






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 21 at 22:12







      Akira

















      asked Mar 21 at 21:57









      AkiraAkira

      848




      848






















          1 Answer
          1






          active

          oldest

          votes


















          1














          there are lots of ways. you can try this:



          GET logs/_search

          "query":
          "script":
          "script":
          """
          if (doc["log.keyword"].value == null) return false;
          return doc["log.keyword"].value.contains("Duplicate entry");
          """





          in kibana 5 triple quotes might not work. i don't remember exactly. just replace with single quotes






          share|improve this answer























          • Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

            – Akira
            Mar 25 at 18:20











          • post your whole request (full dsl query) to ES

            – Andrey Borisko
            Mar 25 at 20:36











          • @Abdrey, I am using the scripted field, how can I post the full dsl query

            – Akira
            Mar 25 at 22:15











          • if you return params._source.log what do you see?

            – Andrey Borisko
            Mar 26 at 16:51












          • I was using the painless instead of json. so where can I insert this params._source.log

            – Akira
            Mar 27 at 18:22











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289869%2fhow-to-search-substring-from-log-field-using-the-scripted-fields-in-painless-wit%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          there are lots of ways. you can try this:



          GET logs/_search

          "query":
          "script":
          "script":
          """
          if (doc["log.keyword"].value == null) return false;
          return doc["log.keyword"].value.contains("Duplicate entry");
          """





          in kibana 5 triple quotes might not work. i don't remember exactly. just replace with single quotes






          share|improve this answer























          • Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

            – Akira
            Mar 25 at 18:20











          • post your whole request (full dsl query) to ES

            – Andrey Borisko
            Mar 25 at 20:36











          • @Abdrey, I am using the scripted field, how can I post the full dsl query

            – Akira
            Mar 25 at 22:15











          • if you return params._source.log what do you see?

            – Andrey Borisko
            Mar 26 at 16:51












          • I was using the painless instead of json. so where can I insert this params._source.log

            – Akira
            Mar 27 at 18:22















          1














          there are lots of ways. you can try this:



          GET logs/_search

          "query":
          "script":
          "script":
          """
          if (doc["log.keyword"].value == null) return false;
          return doc["log.keyword"].value.contains("Duplicate entry");
          """





          in kibana 5 triple quotes might not work. i don't remember exactly. just replace with single quotes






          share|improve this answer























          • Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

            – Akira
            Mar 25 at 18:20











          • post your whole request (full dsl query) to ES

            – Andrey Borisko
            Mar 25 at 20:36











          • @Abdrey, I am using the scripted field, how can I post the full dsl query

            – Akira
            Mar 25 at 22:15











          • if you return params._source.log what do you see?

            – Andrey Borisko
            Mar 26 at 16:51












          • I was using the painless instead of json. so where can I insert this params._source.log

            – Akira
            Mar 27 at 18:22













          1












          1








          1







          there are lots of ways. you can try this:



          GET logs/_search

          "query":
          "script":
          "script":
          """
          if (doc["log.keyword"].value == null) return false;
          return doc["log.keyword"].value.contains("Duplicate entry");
          """





          in kibana 5 triple quotes might not work. i don't remember exactly. just replace with single quotes






          share|improve this answer













          there are lots of ways. you can try this:



          GET logs/_search

          "query":
          "script":
          "script":
          """
          if (doc["log.keyword"].value == null) return false;
          return doc["log.keyword"].value.contains("Duplicate entry");
          """





          in kibana 5 triple quotes might not work. i don't remember exactly. just replace with single quotes







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 21 at 22:24









          Andrey BoriskoAndrey Borisko

          2,44311527




          2,44311527












          • Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

            – Akira
            Mar 25 at 18:20











          • post your whole request (full dsl query) to ES

            – Andrey Borisko
            Mar 25 at 20:36











          • @Abdrey, I am using the scripted field, how can I post the full dsl query

            – Akira
            Mar 25 at 22:15











          • if you return params._source.log what do you see?

            – Andrey Borisko
            Mar 26 at 16:51












          • I was using the painless instead of json. so where can I insert this params._source.log

            – Akira
            Mar 27 at 18:22

















          • Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

            – Akira
            Mar 25 at 18:20











          • post your whole request (full dsl query) to ES

            – Andrey Borisko
            Mar 25 at 20:36











          • @Abdrey, I am using the scripted field, how can I post the full dsl query

            – Akira
            Mar 25 at 22:15











          • if you return params._source.log what do you see?

            – Andrey Borisko
            Mar 26 at 16:51












          • I was using the painless instead of json. so where can I insert this params._source.log

            – Akira
            Mar 27 at 18:22
















          Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

          – Akira
          Mar 25 at 18:20





          Thanks for the reply.I use the the script like this: doc['log.keyword'].value.contains('Error') It doesnt work. However, I just simply display all log messages using doc['log.keyword'].value It works, I am pretty sure the log messages have word "Error", I did not capture that. do you know what the issue is? Thanks

          – Akira
          Mar 25 at 18:20













          post your whole request (full dsl query) to ES

          – Andrey Borisko
          Mar 25 at 20:36





          post your whole request (full dsl query) to ES

          – Andrey Borisko
          Mar 25 at 20:36













          @Abdrey, I am using the scripted field, how can I post the full dsl query

          – Akira
          Mar 25 at 22:15





          @Abdrey, I am using the scripted field, how can I post the full dsl query

          – Akira
          Mar 25 at 22:15













          if you return params._source.log what do you see?

          – Andrey Borisko
          Mar 26 at 16:51






          if you return params._source.log what do you see?

          – Andrey Borisko
          Mar 26 at 16:51














          I was using the painless instead of json. so where can I insert this params._source.log

          – Akira
          Mar 27 at 18:22





          I was using the painless instead of json. so where can I insert this params._source.log

          – Akira
          Mar 27 at 18:22



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55289869%2fhow-to-search-substring-from-log-field-using-the-scripted-fields-in-painless-wit%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현