Setting doc_values for _id field in elasticSearch











up vote
0
down vote

favorite












I want to set doc_values for _id field in elastic search As want to perform sorting based on _id



hitting below api to update mapping gives me an error



PUT my_index/my_type/_mapping
{
"properties": {
"_id": {
"type": "keyword",
"doc_values": true
}
}
}


reason : Mapping definition for [_id] has unsupported parameters: [doc_value : true]










share|improve this question




























    up vote
    0
    down vote

    favorite












    I want to set doc_values for _id field in elastic search As want to perform sorting based on _id



    hitting below api to update mapping gives me an error



    PUT my_index/my_type/_mapping
    {
    "properties": {
    "_id": {
    "type": "keyword",
    "doc_values": true
    }
    }
    }


    reason : Mapping definition for [_id] has unsupported parameters: [doc_value : true]










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to set doc_values for _id field in elastic search As want to perform sorting based on _id



      hitting below api to update mapping gives me an error



      PUT my_index/my_type/_mapping
      {
      "properties": {
      "_id": {
      "type": "keyword",
      "doc_values": true
      }
      }
      }


      reason : Mapping definition for [_id] has unsupported parameters: [doc_value : true]










      share|improve this question















      I want to set doc_values for _id field in elastic search As want to perform sorting based on _id



      hitting below api to update mapping gives me an error



      PUT my_index/my_type/_mapping
      {
      "properties": {
      "_id": {
      "type": "keyword",
      "doc_values": true
      }
      }
      }


      reason : Mapping definition for [_id] has unsupported parameters: [doc_value : true]







      elasticsearch kibana






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday

























      asked yesterday









      Steve

      186




      186
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          It is “doc_values”, you are using an incorrect parameter. https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html



          Elastic discourages sorting on _id field. See this



          The value of the _id field is also accessible in aggregations or for sorting, but doing so is discouraged as it requires to load a lot of data in memory. In case sorting or aggregating on the _id field is required, it is advised to duplicate the content of the _id field in another field that has doc_values enabled.



          EDIT



          Create a scripted field for your index pattern with name for. ex id of type string and script doc['_id'].value. See this link for more information on scripted fields. This will create a new field id and copy _id field's value for every document indexed into your indices matching your index pattern. You can then perform sorting on id field.






          share|improve this answer























          • Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
            – Steve
            yesterday












          • how can I copy _id value to a different field?
            – Steve
            yesterday










          • even copying _id gives me same error, how can I use elasticsearch meta fields
            – Steve
            yesterday










          • See my edit above.
            – ben5556
            yesterday











          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',
          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%2f53372613%2fsetting-doc-values-for-id-field-in-elasticsearch%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








          up vote
          0
          down vote













          It is “doc_values”, you are using an incorrect parameter. https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html



          Elastic discourages sorting on _id field. See this



          The value of the _id field is also accessible in aggregations or for sorting, but doing so is discouraged as it requires to load a lot of data in memory. In case sorting or aggregating on the _id field is required, it is advised to duplicate the content of the _id field in another field that has doc_values enabled.



          EDIT



          Create a scripted field for your index pattern with name for. ex id of type string and script doc['_id'].value. See this link for more information on scripted fields. This will create a new field id and copy _id field's value for every document indexed into your indices matching your index pattern. You can then perform sorting on id field.






          share|improve this answer























          • Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
            – Steve
            yesterday












          • how can I copy _id value to a different field?
            – Steve
            yesterday










          • even copying _id gives me same error, how can I use elasticsearch meta fields
            – Steve
            yesterday










          • See my edit above.
            – ben5556
            yesterday















          up vote
          0
          down vote













          It is “doc_values”, you are using an incorrect parameter. https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html



          Elastic discourages sorting on _id field. See this



          The value of the _id field is also accessible in aggregations or for sorting, but doing so is discouraged as it requires to load a lot of data in memory. In case sorting or aggregating on the _id field is required, it is advised to duplicate the content of the _id field in another field that has doc_values enabled.



          EDIT



          Create a scripted field for your index pattern with name for. ex id of type string and script doc['_id'].value. See this link for more information on scripted fields. This will create a new field id and copy _id field's value for every document indexed into your indices matching your index pattern. You can then perform sorting on id field.






          share|improve this answer























          • Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
            – Steve
            yesterday












          • how can I copy _id value to a different field?
            – Steve
            yesterday










          • even copying _id gives me same error, how can I use elasticsearch meta fields
            – Steve
            yesterday










          • See my edit above.
            – ben5556
            yesterday













          up vote
          0
          down vote










          up vote
          0
          down vote









          It is “doc_values”, you are using an incorrect parameter. https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html



          Elastic discourages sorting on _id field. See this



          The value of the _id field is also accessible in aggregations or for sorting, but doing so is discouraged as it requires to load a lot of data in memory. In case sorting or aggregating on the _id field is required, it is advised to duplicate the content of the _id field in another field that has doc_values enabled.



          EDIT



          Create a scripted field for your index pattern with name for. ex id of type string and script doc['_id'].value. See this link for more information on scripted fields. This will create a new field id and copy _id field's value for every document indexed into your indices matching your index pattern. You can then perform sorting on id field.






          share|improve this answer














          It is “doc_values”, you are using an incorrect parameter. https://www.elastic.co/guide/en/elasticsearch/reference/current/doc-values.html



          Elastic discourages sorting on _id field. See this



          The value of the _id field is also accessible in aggregations or for sorting, but doing so is discouraged as it requires to load a lot of data in memory. In case sorting or aggregating on the _id field is required, it is advised to duplicate the content of the _id field in another field that has doc_values enabled.



          EDIT



          Create a scripted field for your index pattern with name for. ex id of type string and script doc['_id'].value. See this link for more information on scripted fields. This will create a new field id and copy _id field's value for every document indexed into your indices matching your index pattern. You can then perform sorting on id field.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          ben5556

          1,275138




          1,275138












          • Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
            – Steve
            yesterday












          • how can I copy _id value to a different field?
            – Steve
            yesterday










          • even copying _id gives me same error, how can I use elasticsearch meta fields
            – Steve
            yesterday










          • See my edit above.
            – ben5556
            yesterday


















          • Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
            – Steve
            yesterday












          • how can I copy _id value to a different field?
            – Steve
            yesterday










          • even copying _id gives me same error, how can I use elasticsearch meta fields
            – Steve
            yesterday










          • See my edit above.
            – ben5556
            yesterday
















          Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
          – Steve
          yesterday






          Corrected doc_values, still getting an error Field [_id] is defined twice in [type]. There is no field with _id in my mapping
          – Steve
          yesterday














          how can I copy _id value to a different field?
          – Steve
          yesterday




          how can I copy _id value to a different field?
          – Steve
          yesterday












          even copying _id gives me same error, how can I use elasticsearch meta fields
          – Steve
          yesterday




          even copying _id gives me same error, how can I use elasticsearch meta fields
          – Steve
          yesterday












          See my edit above.
          – ben5556
          yesterday




          See my edit above.
          – ben5556
          yesterday


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372613%2fsetting-doc-values-for-id-field-in-elasticsearch%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

          Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

          ts Property 'filter' does not exist on type '{}'

          mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window