Skip to content

Index IDictionary as not_analyzed #469

@Nesse

Description

@Nesse

I'm trying to index this Dictionary as not_analyzed but it's not mapping correctly:

[ElasticProperty(Type = FieldType.nested, Index = FieldIndexOption.not_analyzed)]
public IDictionary<string, List<FilterAttributeOption>> Specifications { get; set; }

public class FilterAttributeOption
{
    [ElasticProperty(Index = FieldIndexOption.not_analyzed)]
    public int FilterId { get; set; }

    [ElasticProperty(Index = FieldIndexOption.not_analyzed)]
    public string Name { get; set; }

    [JsonIgnore]
    public  string FilterUrl { get; set; }
}

elasticsearchClient.CreateIndex(_elasticsearchCoreSettings.IndexName, s => s
    .AddMapping<ProductExt>(m => m.MapFromAttributes())
    .NumberOfReplicas(1)
    .NumberOfShards(1)
);

How can i map my dictionary to be not_analyzed? Is there a default to use on all my properties to be not_analyzed?

example of mapping:

  "specifications" : {
    "type" : "nested",
    "properties" : {
      "binnenvoering" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "bovenmateriaal" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "geslacht" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "hakhoogte" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "hakvorm" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "kleur" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "leeftijd" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "length" : {
        "type" : "integer"
      },
      "seizoen" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "status" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "type" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "uitneembare_zool" : {
        "properties" : {
          "filterId" : {
            "type" : "long"
          },
          "name" : {
            "type" : "string"
          }
        }
      }
    }
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions