Skip to content

Remove multiple types per index from documentation #3139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
</PropertyGroup>

<!-- If shasum and awk exist get the hashes -->
<Exec Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
</Exec>
<Exec Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
</Exec>

Expand Down
112 changes: 40 additions & 72 deletions src/Tests/ClientConcepts/HighLevel/Mapping/AttributeMapping.doc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,16 @@ namespace Tests.ClientConcepts.HighLevel.Mapping
* When you use attributes, you *must* also call `.AutoMap()` for the attributes to be applied.
* --
*
* Here we define the same two types as before, but this time using attributes to define the mappings.
* Here we define an `Employee` type and use attributes to define the mappings.
*/
public class AttributeMapping
{
private IElasticClient client = TestClient.GetInMemoryClient(c => c.DisableDirectStreaming());

[ElasticsearchType(Name = "company")]
public class Company
{
[Keyword(NullValue = "null", Similarity = "BM25")]
public string Name { get; set; }

[Text(Name = "office_hours")]
public TimeSpan? HeadOfficeHours { get; set; }

[Object(Store = false)]
public List<Employee> Employees { get; set; }
}

[ElasticsearchType(Name = "employee")]
public class Employee
{
[Text(Name = "first_name")]
[Text(Name = "first_name", Norms = false, Similarity = "LMDirichlet")]
public string FirstName { get; set; }

[Text(Name = "last_name")]
Expand All @@ -66,15 +53,29 @@ public class Employee
[Nested]
[PropertyName("empl")]
public List<Employee> Employees { get; set; }

[Text(Name = "office_hours")]
public TimeSpan? OfficeHours { get; set; }

[Object(Store = false)]
public List<Skill> Skills { get; set; }
}

public class Skill
{
[Text]
public string Name { get; set; }

[Number(NumberType.Byte, Name = "level")]
public int Proficiency { get; set; }
}

/**Then we map the types by calling `.AutoMap()` */
[U]
public void UsingAutoMapWithAttributes()
{
var createIndexResponse = client.CreateIndex("myindex", c => c
.Mappings(ms => ms
.Map<Company>(m => m.AutoMap())
.Map<Employee>(m => m.AutoMap())
)
);
Expand All @@ -86,61 +87,6 @@ public void UsingAutoMapWithAttributes()
{
mappings = new
{
company = new
{
properties = new
{
employees = new
{
properties = new
{
birthday = new
{
format = "MMddyyyy",
type = "date"
},
empl = new
{
properties = new {},
type = "nested"
},
first_name = new
{
type = "text"
},
isManager = new
{
null_value = false,
store = true,
type = "boolean"
},
last_name = new
{
type = "text"
},
salary = new
{
coerce = true,
doc_values = false,
ignore_malformed = true,
type = "float"
}
},
type = "object",
store = false
},
name = new
{
null_value = "null",
similarity = "BM25",
type = "keyword"
},
office_hours = new
{
type = "text"
}
}
},
employee = new
{
properties = new
Expand All @@ -157,7 +103,9 @@ public void UsingAutoMapWithAttributes()
},
first_name = new
{
type = "text"
type = "text",
norms = false,
similarity = "LMDirichlet"
},
isManager = new
{
Expand All @@ -169,12 +117,32 @@ public void UsingAutoMapWithAttributes()
{
type = "text"
},
office_hours = new
{
type = "text"
},
salary = new
{
coerce = true,
doc_values = false,
ignore_malformed = true,
type = "float"
},
skills = new
{
properties = new
{
level = new
{
type = "byte"
},
name = new
{
type = "text"
}
},
type = "object",
store = false
}
}
}
Expand Down
Loading